/* Дополнения к оригинальной вёрстке clash-service для новых блоков CMS */

/* Фирменный шрифт: WOFF2 (на 20% легче WOFF) и font-display: swap — текст виден сразу
   системным шрифтом, а не ждёт загрузки. Правило позже main.min.css, поэтому главнее. */
@font-face {
	font-family: 'SupercellMagic';
	src: url('fonts/supercell-magic/supercell-magic.woff2') format('woff2'),
	     url('fonts/supercell-magic/supercell-magic.woff') format('woff');
	font-display: swap;
}

/* width/height у картинок задают только пропорции (резерв места против CLS);
   :where() — нулевая специфичность, размеры из классов старой вёрстки главнее */
:where(img[width][height]) { height: auto; }

.cms-banner { display: block; text-align: center; }
.cms-banner img { max-width: 100%; height: auto; display: block; margin: 0 auto; }

/* Проданные лоты */
.is-sold { opacity: .72; }
.is-sold:hover { opacity: 1; }
.Account__full.cms-sold { background: #6b6b6b; color: #fff; }
/* У карточек Royale/Brawl плашка абсолютная и без ширины — растягиваем как у Clash */
.Royale.Product_Premium_account .Account__full.cms-sold { left: 10px; right: 10px; }
.cms-sold-notice { margin: 15px 0; padding: 12px 14px; background: #fff3d6; border-radius: 6px; color: #5a4400; line-height: 1.4; }

/* Кнопка покупки на странице лота — ссылка вместо <p> старого сайта */
#AccountInfo a.Account__buy { display: block; text-align: center; }

/* Сортировка в разделе */
.cms-sort { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.cms-sort__item span { font-size: 13px; }

/* Таблицы в SEO-текстах (уровни героев по ТХ и т.п.) */
.cms-text table { border-collapse: collapse; margin: 0 0 14px; min-width: 320px; }
.cms-text th, .cms-text td { border: 1px solid rgba(255,255,255,.18); padding: 6px 12px; text-align: left; }
.cms-text td + td, .cms-text th + th { text-align: center; }
.cms-text thead th { background: rgba(255,255,255,.08); }
.cms-text tbody tr:nth-child(even) { background: rgba(255,255,255,.03); }
@media (max-width: 639px) {
	.cms-text table { display: block; overflow-x: auto; max-width: 100%; }
}

/* Плитки игр на главной: третья (буст) — по центру отдельной строки, шириной как остальные */
.main-games-line-short .main-games-block-center { grid-column: 2 / 4; }
@media (max-width: 639px) {
	.main-games-line-short .main-games-block-center { grid-column: 1 / 3; justify-self: center; width: calc((100% - 20px) / 2); }
}

/* Пагинация разделов: номера страниц + «Назад/Вперёд» */
#catalog { scroll-margin-top: 16px; }
.cms-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.cms-pager__nums { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.cms-pager .Btn { margin-bottom: 0; }
.cms-pager__num { min-width: 2.4em; padding: 0 8px; text-align: center; }
span.cms-pager__num { cursor: default; }
.cms-pager__gap { padding: 0 2px; font-weight: bold; }
.cms-pager__prev { grid-column: 1; justify-self: start; }
.cms-pager__next { grid-column: 3; justify-self: end; }
@media (max-width: 639px) {
	/* На телефоне номера — строкой сверху, «Назад/Вперёд» — под ними по краям */
	.cms-pager { grid-template-columns: 1fr 1fr; }
	.cms-pager__nums { grid-column: 1 / -1; grid-row: 1; }
	.cms-pager__prev { grid-column: 1; grid-row: 2; }
	.cms-pager__next { grid-column: 2; grid-row: 2; }
}

.cms-empty { padding: 30px 0; text-align: center; }
.cms-empty p { margin-bottom: 15px; }

/* Тексты из редактора */
.cms-text { line-height: 1.55; }
.cms-text p { margin: 0 0 12px; }
.cms-text h2, .cms-text h3 { margin: 22px 0 10px; }
/* Отступ списка — только свой: браузер добавлял ещё 40 px, и пункты уезжали на 62 px */
.cms-text ul, .cms-text ol { margin: 0 0 12px; padding-left: 22px; }
.cms-text li { margin-bottom: 4px; }
/* Цитаты в статьях: выдержки из официальных источников и «совет» редакции */
.cms-text blockquote { margin: 16px 0; padding: 12px 16px; border-left: 4px solid #f0a020; background: rgba(255,255,255,.05); border-radius: 0 6px 6px 0; }
.cms-text blockquote p:last-child { margin-bottom: 0; }
.cms-text blockquote cite { display: block; margin-top: 6px; font-size: 13px; font-style: normal; opacity: .7; }
.cms-text blockquote cite::before { content: "— "; }
.cms-text ul li { list-style: disc; }
.cms-text ol li { list-style: decimal; }
.cms-text img { max-width: 100%; height: auto; }
.cms-text a { text-decoration: underline; }

/* Отзывы */
.cms-review { padding: 14px 0; border-bottom: 1px solid rgba(0, 0, 0, .1); }
.cms-review__head { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; color: #777; }
.cms-review__head b { color: inherit; }
.cms-review__text { white-space: pre-line; }

/* Картинки товаров партнёра (квадратные) в карточке и на странице лота */
.Product_Premium_account img.cms-ext-image { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; }
.PageAccount img.cms-ext-image { width: 100%; max-width: 220px; height: auto; border-radius: 12px; }

/* Текст только для поисковиков и скринридеров (дополняет анкор, не ломая дизайн плиток) */
.cms-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Заголовки h2 вместо div.tile — без браузерных отступов и жирности */
h2.tile, h2.Content__title { font-weight: inherit; }

/* Хлебные крошки */
.cms-breadcrumbs ol { list-style: none; margin: 18px 0 0; padding: 0; font-size: 14px; line-height: 1.5; color: #b9b2a5; }
.cms-breadcrumbs li { display: inline; }
.cms-breadcrumbs li + li::before { content: "›"; margin: 0 8px; color: #8a8273; }
.cms-breadcrumbs a { color: #ffb651; text-decoration: none; }
.cms-breadcrumbs a:hover, .cms-breadcrumbs a:focus-visible { text-decoration: underline; }

/* Блог: список статей */
.cms-blog-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cms-blog-card { display: flex; flex-direction: column; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 8px; overflow: hidden; }
.cms-blog-card__cover { display: block; text-decoration: none; aspect-ratio: 1200 / 630; background: linear-gradient(180deg, #4079B3 0%, #0A2966 100%); }
.cms-blog-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cms-blog-card__placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-family: SupercellMagic, Arial; color: #fff; text-shadow: 0 2px #000; }
.cms-blog-card__body { padding: 14px 16px 16px; }
.cms-blog-card__meta { margin: 0 0 6px; font-size: 13px; opacity: .7; }
.cms-blog-card__title { margin: 0 0 8px; font-size: 18px; line-height: 1.3; }
.cms-blog-card__title a { color: inherit; text-decoration: none; }
.cms-blog-card__title a:hover { text-decoration: underline; }
.cms-blog-card__excerpt { margin: 0; font-size: 14px; line-height: 1.5; opacity: .85; }
.cms-blog-list--compact .cms-blog-card__title { font-size: 16px; }
@media (max-width: 939px) { .cms-blog-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px) { .cms-blog-list { grid-template-columns: 1fr; } }

/* Блог: компактные отступы (стили темы рассчитаны на разделы каталога с плитками) */
.SiteContent.cms-blog-page { margin-top: 24px; }
.cms-blog-page .cms-breadcrumbs ol { margin-top: 0; }
.cms-blog-page .SiteContent__title { margin-top: 8px; margin-bottom: 0; }
.cms-blog-page .SiteContent__title h1 { padding-bottom: 0; }
.cms-blog-page .cms-post__meta { margin: 10px 0 20px; }
.cms-blog-page .cms-blog-list { margin-top: 24px; }
.cms-blog-page .SiteContent__title + .cms-text { margin-top: 16px; }
/* Мобильная тема добавляет каждому блоку .gridcol12 снизу 40/20 px, заголовку — 30 px сверху: в статье это пустоты */
.cms-blog-page .grid12 > .gridcol12 { padding-bottom: 0; }
.cms-blog-page .gridcol12.SiteContent__title { padding-top: 0; }
.cms-blog-page .SiteContent__title h1 { padding-top: 0; }
.cms-blog-page .cms-post__content, .cms-blog-page .cms-post__catalog, .cms-blog-page .cms-post__cover { margin-bottom: 28px; }

/* Блог: статья */
.cms-post__meta { font-size: 14px; text-align: center; opacity: .75; }
.cms-post__draft { color: #f0a020; }
.cms-post__cover img { width: 100%; height: auto; border-radius: 8px; display: block; }
.cms-post__content { max-width: 760px; font-size: 16px; }
.cms-post__content img { max-width: 100%; height: auto; border-radius: 6px; }
.cms-post__catalog { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px; border-radius: 8px; background: rgba(255,255,255,.05); }
.cms-post__catalog-title { width: 100%; margin: 0 0 4px; font-weight: bold; }
.cms-post__catalog .Btn { margin-bottom: 0; }

/* WebP: фон шапки (jpg из main.min.css остаётся запасным) и плитки главной в <picture> */
.SiteHeader:not(.SiteHeaderPromo) { background-image: image-set(url(../img/style/header-bg4.webp) type("image/webp"), url(../img/style/header-bg4.jpg) type("image/jpeg")); }
.main-games-block picture { display: contents; }
.main-games-block:hover picture img { box-shadow: 0 0px 20px #2f908c; }

/* Карточка товара: длинное название — в две строки с «…», вместо обрезки по краю.
   Высота блока + отступы равны старым (одна строка 22px), чтобы картинка и цена не сдвигались. */
.Product_Premium_account .Product__title {
	white-space: normal; overflow: hidden; overflow-wrap: anywhere;
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
	line-height: 18px; height: 36px; margin: 3px 0 16px;
}
@media (max-width: 639px) {
	.Product_Premium_account .Product__title { line-height: 20px; height: 40px; margin: 10px 0 8px; }
}

/* Логотип в шапке: тема растягивает картинку на всю ширину и одновременно ограничивает высоту шапкой —
   на телефоне пропорции ломались (575×159 → 375×66) и логотип уходил под кнопку меню.
   Ширина — от высоты, по пропорциям картинки. */
.SiteHeader__logo img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 639px) {
	.SiteHeader__logo img { max-width: calc(100% - 64px); }   /* место под кнопку меню справа */
}

/* Переключатель игр на страницах каталога: тема рассчитана на 3 плитки по 300 px (на телефоне — столбиком).
   С 7 играми — компактная сетка, а на телефоне одна строка с прокруткой вбок. */
.games-selector { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.games-selector-block { display: flex; align-items: center; max-width: none; flex: none; height: 56px; padding: 8px 14px; margin: 0; text-align: left; }
.games-selector-icon { width: 36px; height: 36px; margin-right: 12px; flex: none; }
.games-selector-block span { line-height: 1.2; }
@media (max-width: 639px) {
	.games-selector { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
	.games-selector-block { flex: 0 0 auto; height: 48px; padding: 6px 12px; margin: 0; scroll-snap-align: start; white-space: nowrap; }
	.games-selector-icon { width: 30px; height: 30px; margin-right: 8px; }
}

/* Блог: сайдбар с каталогом (ПК) и вставки товаров в текст статьи */
.cms-post__layout { display: block; }
.cms-post__sidebar { display: none; }
@media (min-width: 940px) {
	.cms-post__layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
	.cms-post__sidebar { display: block; position: sticky; top: 16px; }
	.cms-post__layout .cms-post__content { max-width: none; }
}
.cms-side__block { margin-bottom: 18px; padding: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 8px; }
.cms-side__title { margin: 0 0 10px; font-weight: bold; font-size: 15px; }
.cms-side__row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid rgba(255,255,255,.08); color: inherit; text-decoration: none; font-size: 14px; }
.cms-side__row:first-of-type { border-top: 0; }
.cms-side__row:hover .cms-side__label { text-decoration: underline; }
.cms-side__label { flex: 1; }
.cms-side__meta { color: #8fd14f; font-weight: bold; white-space: nowrap; }
.cms-side__cards { display: grid; gap: 8px; }

.cms-mini { display: flex; gap: 10px; align-items: center; padding: 8px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 8px; color: inherit; text-decoration: none; min-width: 0; }
.cms-mini:hover { border-color: rgba(255,255,255,.3); }
.cms-mini img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; background: rgba(0,0,0,.2); }
.cms-mini__body { display: flex; flex-direction: column; min-width: 0; }
.cms-mini__title { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cms-mini__meta { font-size: 12px; opacity: .6; }
.cms-mini__price { font-weight: bold; color: #8fd14f; font-size: 14px; }

/* Вставки внутри .cms-text: сбрасываем оформление текста статьи */
.cms-text .cms-promo { margin: 22px 0; padding: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; }
.cms-text .cms-promo a { text-decoration: none; }
.cms-promo__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 10px !important; font-weight: bold; }
.cms-promo__head a { font-weight: normal; font-size: 14px; color: #f0a020; white-space: nowrap; }
.cms-promo__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cms-promo__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cms-chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; color: inherit; }
.cms-chip:hover { border-color: rgba(255,255,255,.35); }
.cms-chip img { width: 28px; height: 28px; }
.cms-chip__label { font-weight: bold; }
.cms-chip__meta { font-size: 13px; color: #8fd14f; }
@media (max-width: 639px) {
	/* на телефоне ряд товаров прокручивается вбок */
	.cms-promo__row { display: flex; overflow-x: auto; scroll-snap-type: x proximity; }
	.cms-promo__row .cms-mini { flex: 0 0 78%; scroll-snap-align: start; }
	.cms-promo__chips { flex-direction: column; }
}
