/* =========================================================================
   MM2 Scripts — components.css
   Карточки, бейджи, статусы, фильтр, блок кода, кнопки, FAQ, executor.
   Правила брифа: только border (никаких box-shadow), красный — только
   у CTA и кнопки копирования, hover меняет лишь border-color/opacity.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Кнопки
   ---------------------------------------------------------------------- */
.btn-primary {
	display: inline-flex; align-items: center; justify-content: center;
	gap: 8px;
	padding: 13px 24px;
	background: var(--accent);
	color: #fff;
	font-family: var(--font-body);
	font-weight: 700; font-size: 16px;
	border: 1px solid var(--accent);
	border-radius: var(--radius-sm);
	text-decoration: none; cursor: pointer;
	transition: opacity .15s ease, background-color .15s ease;
}
.btn-primary:hover { color: #fff; opacity: .9; background: var(--accent-hover); }

.link-btn {
	background: none; border: 0; padding: 0;
	color: var(--accent); font: inherit; cursor: pointer;
	text-decoration: underline;
}
.link-btn:hover { opacity: .85; }

/* Заметная кнопка скачивания на карточке (ведёт на /download/) */
.btn-download {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%;
	padding: 13px 16px;
	margin: 4px 0 10px;
	background: var(--accent);
	color: #fff;
	font-family: var(--font-body); font-weight: 700; font-size: 15px;
	border: 1px solid var(--accent);
	border-radius: var(--radius-sm);
	text-decoration: none;
	transition: opacity .15s ease, background-color .15s ease;
}
.btn-download:hover { color: #fff; opacity: .92; background: var(--accent-hover); }
.btn-download svg { flex: none; }

/* -------------------------------------------------------------------------
   Сетка скриптов
   ---------------------------------------------------------------------- */
.scripts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
	gap: 20px;
}
.scripts-empty { color: var(--text-muted); padding: 20px 0; }

/* -------------------------------------------------------------------------
   Карточка скрипта
   ---------------------------------------------------------------------- */
.script-card {
	display: flex; flex-direction: column;
	min-width: 0; /* не даём длинному коду раздувать карточку (grid blowout) */
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
	padding: 22px;
	transition: border-color .15s ease;
}
.script-card:hover { border-color: var(--text-muted); }

.script-card__media {
	margin: -22px -22px 16px;
	border-bottom: 1px solid var(--border);
	border-radius: 11px 11px 0 0;
	overflow: hidden;
	background: var(--bg-code);
	aspect-ratio: 16 / 9;
}
.script-card__media img {
	width: 100%; height: 100%;
	object-fit: cover; display: block;
}

.script-card__head { margin-bottom: 12px; }
.script-card__title { font-size: 21px; margin: 0 0 10px; }

.script-card__status {
	display: inline-flex; align-items: center; gap: 8px;
	font-size: 13px; font-weight: 500;
	margin: 0 0 12px; color: var(--text-muted);
}
.status-dot {
	width: 9px; height: 9px; border-radius: 999px;
	display: inline-block; flex: none;
}
.script-card__status.is-working .status-dot { background: var(--ok); }
.script-card__status.is-working { color: var(--ok); }
.script-card__status.is-unchecked .status-dot {
	background: transparent; border: 2px solid var(--text-muted);
}

.script-card__desc { color: var(--text-primary); opacity: .85; margin: 0 0 14px; }

.script-card__features {
	list-style: none; margin: 0 0 16px; padding: 0;
	display: grid; gap: 7px;
}
.script-card__features li {
	position: relative; padding-left: 22px;
	font-size: 14.5px; color: var(--text-muted);
}
.script-card__features li::before {
	content: '✓';
	position: absolute; left: 0; top: 0;
	color: var(--accent-dim); font-weight: 700;
}

.script-card__executors {
	margin: 14px 0 0; font-size: 13px; color: var(--text-muted);
	border-top: 1px solid var(--border); padding-top: 12px;
}
.script-card__executors-label { color: var(--text-primary); font-weight: 500; }

/* -------------------------------------------------------------------------
   Бейджи
   ---------------------------------------------------------------------- */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
	display: inline-block;
	font-size: 11px; font-weight: 600;
	padding: 3px 8px; border-radius: var(--radius-sm);
	letter-spacing: .02em; white-space: nowrap;
}
.badge--cat {
	background: var(--accent-dim);
	color: var(--accent-light);
}
.badge--no-key {
	background: transparent;
	color: var(--text-primary);
	border: 1px solid var(--text-muted);
	text-transform: uppercase; letter-spacing: .04em;
}
.badge--platform {
	background: var(--bg-elevated);
	color: var(--text-muted);
	border: 1px solid var(--border);
}

/* -------------------------------------------------------------------------
   Фильтр-строка
   ---------------------------------------------------------------------- */
.filter-bar {
	display: flex; flex-wrap: wrap; gap: 10px;
	margin-bottom: 28px;
}
.filter-btn {
	padding: 9px 18px;
	background: transparent;
	color: var(--text-muted);
	border: 1px solid var(--border);
	border-radius: 999px;
	font-family: var(--font-body); font-weight: 500; font-size: 15px;
	cursor: pointer;
	transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.filter-btn:hover { border-color: var(--text-muted); color: var(--text-primary); }
.filter-btn.active {
	background: var(--bg-elevated);
	color: var(--text-primary);
	border-color: var(--text-muted);
}

/* -------------------------------------------------------------------------
   Блок кода + кнопка копирования
   ---------------------------------------------------------------------- */
.code-block {
	position: relative;
	min-width: 0; /* пара к .script-card min-width:0 — pre скроллится, не растягивает */
	background: var(--bg-code);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	margin: 4px 0 4px;
}
.code-block__pre {
	margin: 0;
	padding: 16px 14px;
	overflow-x: auto;
	font-family: var(--font-code);
	font-size: 13px; line-height: 1.6;
	color: var(--text-primary);
}
.code-block__pre code { white-space: pre; word-break: normal; }

.copy-btn {
	display: block; width: 100%;
	margin-top: 0;
	padding: 11px 16px;
	background: transparent;
	color: var(--text-primary);
	font-family: var(--font-body); font-weight: 600; font-size: 14px;
	border: 0;
	border-top: 1px solid var(--border);
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.copy-btn:hover { background: var(--bg-elevated); color: var(--accent); }
.copy-btn.is-copied { color: var(--ok); }

/* -------------------------------------------------------------------------
   FAQ (нативные details/summary)
   ---------------------------------------------------------------------- */
.faq__list { display: grid; gap: 10px; }
.faq__item {
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-card);
	overflow: hidden;
}
.faq__q {
	cursor: pointer;
	padding: 16px 44px 16px 18px;
	position: relative;
	font-weight: 500; color: var(--text-primary);
	list-style: none;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after {
	content: '+';
	position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
	font-size: 22px; color: var(--text-muted); line-height: 1;
}
.faq__item[open] .faq__q::after { content: '–'; color: var(--text-primary); }
.faq__item[open] .faq__q { color: var(--text-primary); }
.faq__a {
	padding: 0 18px 16px;
	color: var(--text-muted);
}
.faq__a p { margin: 0 0 8px; }
.faq__a p:last-child { margin-bottom: 0; }
.faq__a a { color: var(--text-primary); }
.faq__a a:hover { opacity: .7; }

/* -------------------------------------------------------------------------
   Карточки executor'ов
   ---------------------------------------------------------------------- */
.exec-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
	gap: 16px; margin-bottom: 8px;
}
.exec-card {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
	padding: 20px;
	transition: border-color .15s ease;
}
.exec-card:hover { border-color: var(--text-muted); }
.exec-card__head {
	display: flex; align-items: center; gap: 10px;
	margin-bottom: 10px;
}
.exec-card__name { font-size: 20px; margin: 0; }
.exec-card__desc { margin: 0; color: var(--text-muted); font-size: 14.5px; }

/* -------------------------------------------------------------------------
   Дата проверки на карточке
   ---------------------------------------------------------------------- */
.script-card__checked {
	font-size: 12.5px; color: var(--text-muted);
	margin: -6px 0 12px;
}
.script-card__checked time { color: var(--text-primary); }

/* -------------------------------------------------------------------------
   Видео (ленивый YouTube-фасад)
   ---------------------------------------------------------------------- */
.video { padding: 8px 0 48px; }
.yt-facade {
	position: relative; display: block;
	aspect-ratio: 16 / 9;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	cursor: pointer;
	background: var(--bg-code);
}
.yt-facade__poster { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-facade__play {
	position: absolute; inset: 0; margin: auto;
	width: 72px; height: 72px;
	background: var(--accent);
	border-radius: 999px;
	transition: opacity .15s ease;
}
.yt-facade__play::before {
	content: ''; position: absolute;
	top: 50%; left: 50%;
	transform: translate(-40%, -50%);
	border-style: solid;
	border-width: 13px 0 13px 22px;
	border-color: transparent transparent transparent #fff;
}
.yt-facade:hover .yt-facade__play { opacity: .9; }
.yt-facade.is-playing { cursor: default; }
.yt-facade__iframe { width: 100%; height: 100%; border: 0; display: block; }
.video__caption { font-size: 13px; color: var(--text-muted); margin-top: 12px; text-align: center; }

/* -------------------------------------------------------------------------
   Сравнительная таблица
   ---------------------------------------------------------------------- */
.table-wrap {
	overflow-x: auto;
	margin: 4px 0 24px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.compare {
	width: 100%; min-width: 560px;
	border-collapse: collapse;
	font-size: 14.5px;
}
.compare th, .compare td {
	padding: 12px 14px; text-align: left;
	border-bottom: 1px solid var(--border);
}
.compare thead th {
	font-family: var(--font-display); font-weight: 700;
	color: var(--text-primary); background: var(--bg-elevated);
	letter-spacing: .02em;
}
.compare tbody th { font-weight: 500; color: var(--text-primary); }
.compare td { color: var(--text-muted); }
.compare tbody tr:last-child th, .compare tbody tr:last-child td { border-bottom: 0; }

/* -------------------------------------------------------------------------
   Страница скачивания /download/
   ---------------------------------------------------------------------- */
.dl { margin-top: 8px; }
div.dl__box {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-card);
	padding: 28px 24px;
	text-align: center;
	margin-bottom: 28px;
}
.dl__timer { color: var(--text-muted); font-size: 15px; margin: 0; }
.dl__count {
	color: var(--accent); font-weight: 700;
	font-family: var(--font-display); font-size: 18px;
}
.dl__btn { font-size: 17px; padding: 15px 32px; }
/* .btn-primary задаёт display:inline-flex и перебивает браузерный [hidden];
   возвращаем скрытие до конца таймера более специфичным правилом. */
.dl__btn[hidden] { display: none; }
.dl__hint { color: var(--text-muted); font-size: 14px; margin-top: 14px; }

/* -------------------------------------------------------------------------
   Адаптив компонентов
   ---------------------------------------------------------------------- */
@media (max-width: 480px) {
	.scripts-grid { grid-template-columns: minmax(0, 1fr); }
	.script-card { padding: 18px; }
	.script-card__media { margin: -18px -18px 14px; }
	.yt-facade__play { width: 60px; height: 60px; }
	/* Длинный URL переносится, а не раздувает карточку / не требует гориз. скролла */
	.code-block__pre code { white-space: pre-wrap; word-break: break-word; }
}