/* Copyright (C) 2025-2026 adcitymag.ru */
/* adcm-plus / ui */

/* ---- «Аа» и «Поделиться» в строке с датой ---- */
.adcx-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding-left: 1rem;
}
.adcx-toolbtn {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  margin: 0;
  padding: 3px 10px;
  border: 1px solid var(--borderColor, rgba(128, 128, 128, .4));
  border-radius: var(--adcm-r-sm);
  background: transparent;
  color: var(--adcmMuted, var(--greyColor));
  font-family: inherit;
  font-size: var(--t-meta, 12px);
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}
.adcx-toolbtn:hover { color: var(--hoverColor); border-color: currentColor; }
.adcx-toolbtn span:first-child { font-size: var(--t-meta, 11px); }
.adcx-toolbtn span:last-child { font-size: var(--t-body, 16px); }

/* размер текста статьи */
html[data-adcx-fs="lg"] body.single .post-content { font-size: 1.15em; }
html[data-adcx-fs="xl"] body.single .post-content { font-size: 1.3em; }
/* то же на страницах конкурса, события и проекта */
html[data-adcx-fs="lg"] body.single :is(.adcm-evt-body, .adcm-single-body) { font-size: calc(var(--t-card-lg, 1.15rem) * 1.15); }
html[data-adcx-fs="xl"] body.single :is(.adcm-evt-body, .adcm-single-body) { font-size: calc(var(--t-card-lg, 1.15rem) * 1.3); }
.adcx-tools-row { display: flex; justify-content: flex-end; margin: 0 0 var(--adcm-space-4, 16px); }
.adcx-tools-row .adcx-tools { margin-left: 0; padding-left: 0; }

/* ---- Индикатор чтения ---- */
.adcx-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 3px;
  background: var(--adcmAccent, #8c4a3c);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---- Оглавление ---- */
.adcx-toc {
  margin: 0 0 2rem;
  padding: 1rem 1.4rem;
  border-left: 3px solid var(--mainColor);
  border-radius: 0 var(--adcm-r-md, 12px) var(--adcm-r-md, 12px) 0;
  background: rgba(128, 128, 128, .08);
}
.adcx-toc__title { display: block; margin-bottom: .5rem; font-weight: var(--bold, 600); }
.adcx-toc ol { margin: 0; padding-left: 1.2rem; }
.adcx-toc a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(128, 128, 128, .4);
}
.adcx-toc a:hover { color: var(--hoverColor); border-bottom-color: currentColor; text-decoration: none; }
.adcx-toc a.is-active { font-weight: var(--bold, 600); border-bottom-color: currentColor; }
body.single .post-content h2 { scroll-margin-top: 90px; }

/* ---- Карточка «Читать дальше»: слева, чтобы не накрывать кнопку «наверх» ---- */
.adcx-nextup {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 80;
  width: 300px;
  max-width: calc(100vw - 48px);
  padding: 10px 12px;
  border: 1px solid var(--borderColor, rgba(128, 128, 128, .3));
  border-radius: var(--adcm-r-lg);
  background: var(--lightColor, #fff);
  box-shadow: var(--adcm-shadow-4, 0 16px 40px rgba(0, 0, 0, .2));
  opacity: 0;
  transform: translateY(24px);
  transition: transform var(--adcm-dur-base, .22s) ease, opacity var(--adcm-dur-base, .22s) ease;
}
.adcx-nextup[hidden] { display: none; }
.adcx-nextup.is-visible { opacity: 1; transform: none; }
.adcx-nextup__link { display: flex; align-items: center; gap: var(--adcm-space-3); color: inherit; text-decoration: none; }
.adcx-nextup__link:hover { text-decoration: none; }
.adcx-nextup__img { flex: 0 0 auto; width: 72px; height: 48px; object-fit: cover; border-radius: var(--adcm-r-sm); }
.adcx-nextup__text { display: flex; flex-direction: column; gap: 2px; }
.adcx-nextup__label {
  font-size: var(--fs-xs, .75rem);
  font-weight: var(--bold, 600);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--adcmMuted, var(--greyColor));
}
.adcx-nextup__title {
  display: -webkit-box;
  -webkit-line-clamp: 2; /* не больше двух строк */
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--t-ui, .9rem);
  font-weight: var(--bold, 600);
  line-height: 1.3;
}
.adcx-nextup__close {
  position: absolute;
  top: 2px;
  right: 6px;
  border: 0;
  background: none;
  color: var(--adcmMuted, var(--greyColor));
  font-family: inherit;
  font-size: var(--t-c-h2, 22px);
  line-height: 1;
  cursor: pointer;
}
@media (max-width: 900px) { .adcx-nextup { display: none; } } /* на телефоне внизу есть панель навигации */

/* ---- Нижняя панель навигации: только на телефонах ---- */
.adcx-bottombar { display: none; }
@media (max-width: 768px) {
  .adcx-bottombar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--adcm-z-bottombar); /* выше выезжающего меню: «Меню» остаётся доступным и закрывает его */
    display: flex;
    justify-content: space-around;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--borderColor, rgba(128, 128, 128, .25));
    background: var(--lightColor, #fff);
  }
  .adcx-bottombar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 56px;
    min-height: 44px;
    font-size: var(--t-meta, 11px);
    color: var(--adcmMuted, var(--greyColor));
    text-decoration: none;
  }
  .adcx-bottombar__item:hover { color: var(--hoverColor); text-decoration: none; }
  .adcx-bottombar__icon { position: relative; font-size: var(--t-h3, 20px); line-height: 1; }
  .adcx-bottombar__badge { position: absolute; top: -6px; left: 55%; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: var(--adcm-r-pill); background: var(--adcmAccent, #c2410c); color: var(--adcm-c-white, #fff); font-size: var(--t-label, 10px); line-height: 16px; text-align: center; }
  .adcx-bottombar__badge[hidden] { display: none; }
  .adcx-bottombar__item.is-active { color: var(--mainColor); font-weight: var(--medium, 500); }
  /* кнопка «наверх» и подвал не прячутся под панелью */
  body { padding-bottom: 56px; }
  html body .back-to-top { bottom: calc(56px + 16px + env(safe-area-inset-bottom, 0px)); right: 14px; z-index: calc(var(--adcm-z-bottombar, 1000) - 1); }
}
@media (max-height: 480px) and (orientation: landscape) {
  .adcx-bottombar { display: none; }
  body { padding-bottom: 0; }
  html body .back-to-top { bottom: 16px; }
}

/* ---- Подписка ---- */
.adcx-subscribe {
  margin: 32px 0;
  padding: 20px;
  border-radius: var(--adcm-r-md);
  background: rgba(128, 128, 128, .08);
}
.adcx-subscribe__title { display: block; margin-bottom: 12px; font-weight: var(--bold, 600); }
.adcx-subscribe__row { display: flex; flex-wrap: wrap; gap: var(--adcm-space-2); }
.adcx-subscribe__row input[type="email"] {
  flex: 1 1 220px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--borderColor, rgba(128, 128, 128, .4));
  border-radius: var(--adcm-r-sm);
  background: var(--bodyBg, transparent);
  color: var(--mainColor);
  font: inherit;
}
.adcx-subscribe__row input[type="email"]:focus-visible { outline: 2px solid var(--hoverColor, currentColor); outline-offset: 1px; }
.adcx-subscribe__row button {
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: var(--adcm-r-sm);
  background: var(--mainColor);
  color: var(--lightColor, #fff);
  font: inherit;
  cursor: pointer;
}
.adcx-subscribe__agree { display: block; margin-top: 8px; font-size: var(--fs-xs, .75rem); color: var(--adcmMuted, var(--greyColor)); }

/* отступы над подвалом: блоки главной не складывают поля с полем подвала */
.adcx-home-end { margin: 2rem auto 0; width: 100%; }
.adcx-home-end .adcx-subscribe { margin: 0; }
.main > .adcx-trending:last-child, .main > .adcx-showcase:last-child { margin-bottom: 0; }

/* кнопка «Загрузить ещё»: состояние ошибки с возможностью повторить */
.load-more-posts.is-error, #load-more-posts:not(:disabled)[aria-busy="false"] { border-color: var(--adcm-danger, #b91c1c); color: var(--adcm-danger, #b91c1c); }
.load-more-posts[aria-busy="true"], #load-more-posts[aria-busy="true"] { cursor: progress; }

/* ==========================================================================
   Кнопки шапки: «Сохранённое», тема, поиск, соцсети, меню.
   Одинаковый размер, фон, значки и расстояния между ними.
   ========================================================================== */
:root {
  --adcm-hbtn: 40px;        /* размер круглой кнопки */
  --adcm-hbtn-icon: 22px;   /* размер значка внутри */
  --adcm-hbtn-gap: 8px;     /* расстояние между кнопками */
}
html body .site-header__btns {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--adcm-hbtn-gap);
}
html body .site-header__btns :is(.adcx-hbtn, .theme-switch, .site-search-btn, .mobile-socials-btn, .mobile-menu-btn) {
  box-sizing: border-box; flex: 0 0 auto; margin: 0; padding: 0;
  width: var(--adcm-hbtn); height: var(--adcm-hbtn);
  border: 0; border-radius: var(--adcm-r-circle, 50%);
  background-color: var(--greyBg); color: var(--mainColor);
  transition: background-color var(--adcm-dur-fast, .15s) ease, color var(--adcm-dur-fast, .15s) ease;
}
/* показ кнопок: «три полоски» (.mobile-menu-btn) сюда не входит, её показ на планшете и телефоне задаёт style.css,
   на компьютере она скрыта */
html body .site-header__btns :is(.adcx-hbtn, .theme-switch, .site-search-btn, .mobile-socials-btn) {
  display: inline-flex; align-items: center; justify-content: center;
}
html body .site-header__btns :is(.adcx-hbtn, .site-search-btn, .mobile-socials-btn):hover { color: var(--hoverColor); }
html body .site-header__btns :is(.adcx-hbtn, .site-search-btn, .mobile-socials-btn) svg {
  width: var(--adcm-hbtn-icon); height: var(--adcm-hbtn-icon); flex: 0 0 auto;
}
html body .site-header__btns :is(.site-search-btn, .mobile-socials-btn) svg { fill: currentColor; } /* значок «Сохранённое» линейный, заливку не получает */
/* переключатель темы рисует значок фоном: приводим его к тому же размеру */
html body .site-header__btns .theme-switch { background-size: var(--adcm-hbtn-icon) var(--adcm-hbtn-icon); }
html body .site-header__btns .theme-switch .switch { width: 100%; height: 100%; display: block; }
/* в тёмной теме у всех кнопок одинаковый фон (раньше «Сохранённое» отличалось) */
html[data-theme="dark"] body .site-header__btns :is(.adcx-hbtn, .theme-switch, .site-search-btn, .mobile-socials-btn, .mobile-menu-btn) { background-color: #2a2a2a; color: var(--adcm-c-gray-100, #ededed); }
html[data-theme="dark"] body .site-header__btns .theme-switch { filter: none; }
@media (min-width: 700px) and (max-width: 1100px) { :root { --adcm-hbtn: 44px; } }

/* ==========================================================================
   Скругления и рамки: единая шкала, как в современных системах (Apple и др.)
   Шкала:  xs 4 (метки, мелкие элементы) · sm 8 (кнопки, поля) · md 12 (малые карточки, превью)
           lg 16 (карточки) · xl 20 (крупные панели) · 2xl 28 (обложки, большие блоки)
           pill (таблетки, чипы) · circle (круглые кнопки, аватары)
   Правила:
   1. Вложенные углы концентричны: радиус внутреннего = радиус внешнего минус отступ между ними.
   2. Рамки в 1 px цветом --borderColor, акцентная рамка 2 px только у фокуса и выбранного.
   3. Плавные «непрерывные» углы (squircle, как у Apple) включаются там, где браузер их поддерживает.
   ========================================================================== */
:root { --adcm-concentric-pad: 12px; }

/* картинка внутри карточки: радиус на отступ меньше радиуса карточки */
body :is(.adcm-tcard, .adcm-feat-card, .re-card, .kk-card, .tag-post-card, .adcx-nv-row) :is(img, .adcm-tcard__img, .adcm-tcard__thumb) {
  border-radius: max(var(--adcm-r-xs, 4px), calc(var(--adcm-card-radius, 16px) - var(--adcm-concentric-pad)));
}

/* непрерывные углы: в браузерах без поддержки остаются обычные скругления */
@supports (corner-shape: squircle) {
  body :is(.adcm-card, .adcm-tcard, .adcm-feat-card, .adcm-folio-card, .adcm-chip, .adcm-evt-facts, .adcm-etl__card,
    .re-card, .kk-card, .tag-post-card, .hne-col, .adcx-nv-lead, .adcx-hero, .adcx-bu, .adcx-trending__thumb,
    .load-more-posts, .submit-btn, .site-search-btn, .theme-switch, .adcx-hbtn,
    input:not([type="checkbox"]):not([type="radio"]), select, textarea, button) {
    corner-shape: squircle;
  }
}

/* Меню шапки на широком экране: одна строка, лишние пункты в «Ещё» */
@media (min-width: 1101px) {
  html:not(.adcm-compact) body .site-header__wrap--inline .site-nav--inline .nav-menu { flex-wrap: nowrap; white-space: nowrap; }
  html:not(.adcm-compact) body .site-header__wrap--inline .site-nav--inline { min-width: 0; }
}
body .nav-menu .adcx-more { position: relative; }
body .nav-menu .adcx-more > .sub-menu { right: 0; left: auto; width: 240px; white-space: normal; }
body .nav-menu .adcx-more:hover > .sub-menu, body .nav-menu .adcx-more:focus-within > .sub-menu, body .nav-menu .adcx-more.is-open > .sub-menu { display: block; }

/* Шапка на компьютере: всё меню в одну строку без «Ещё». Шапка шире основного контейнера (как у крупных изданий),
   промежутки плотнее. «Ещё» остаётся только как запасной вариант на узких окнах от 1101 до ~1280 px. */
@media (min-width: 1101px) {
  html body .site-header .site-header__wrap--inline { gap: 16px; }
  html body .site-header__wrap--inline .site-nav--inline .menu-item:not(:last-child) { margin-right: .85rem; }
}
@media (min-width: 1280px) {
  html body .site-header .site-header__wrap--inline { max-width: max(var(--width, 1100px), min(1480px, calc(100% - 48px))); }
}
/* на окнах 1101–1439 px пункты чуть мельче и теснее, чтобы всё меню оставалось в одной строке */
@media (min-width: 1101px) and (max-width: 1439px) {
  html body .site-header__wrap--inline .site-nav--inline .menu-item > a { font-size: var(--t-ui, .9rem); }
  html body .site-header__wrap--inline .site-nav--inline .menu-item:not(:last-child) { margin-right: .65rem; }
}

/* подписка через Telegram, если нет сервиса рассылки */
.adcx-subscribe--social { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--adcm-space-3, 12px); }
.adcx-subscribe__btn { display: inline-flex; align-items: center; height: 40px; padding: 0 20px; border-radius: var(--adcm-r-sm, 8px); background: var(--hoverColor); color: var(--bodyBg, #fff); font-size: var(--t-ui, .88rem); font-weight: var(--medium, 500); text-decoration: none; }
.adcx-subscribe__btn:hover { opacity: .9; text-decoration: none; }

/* ==========================================================================
   Выпадающие списки по всему сайту: единый вид и скруглённые углы.
   1. Закрытое поле: скругление 12 px, своя стрелка, одинаковая высота.
   2. Раскрытый список: в браузерах с настраиваемым <select> (appearance: base-select; Chrome и Edge с 2025 года)
      это карточка со скруглёнными углами, тенью и подсветкой пункта. В остальных браузерах раскрытый список рисует
      сама система (на iPhone это штатное колесо выбора), его оформить нельзя; закрытое поле выглядит так же.
   Списки с множественным выбором и списки-таблицы (size) не затрагиваются. Вес правил намеренно низкий (:where):
   размеры, заданные конкретным блокам (панель фильтров, инструмент RAL), остаются в силе.
   ========================================================================== */
body select:where(:not([multiple]):not([size])) {
  min-height: 40px; height: auto; padding: 0 38px 0 14px;
  border: 1px solid var(--adcm-input-border, #8c90a3); border-radius: var(--adcm-r-md, 12px);
  background-color: var(--lightColor, #fff); color: var(--mainColor, #16202e);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px;
  line-height: 1.3; text-overflow: ellipsis; cursor: pointer;
  transition: border-color var(--adcm-dur-fast, .15s) ease, box-shadow var(--adcm-dur-fast, .15s) ease;
}
body select:where(:not([multiple]):not([size])):hover { border-color: var(--mainColor, #16202e); }
body select:where(:not([multiple]):not([size])):focus-visible { outline: none; border-color: var(--hoverColor, #2849a3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hoverColor, #2849a3) 22%, transparent); }
html[data-theme="dark"] body select:where(:not([multiple]):not([size])) { background-color: var(--darkCard, #1b1f27); border-color: var(--darkBorder, #2a2f3a); color: var(--darkText, #dde3ec); }
@media (pointer: coarse) { body select:where(:not([multiple]):not([size])) { min-height: 44px; } }

@supports (appearance: base-select) {
  body select:where(:not([multiple]):not([size])), body select:where(:not([multiple]):not([size]))::picker(select) { appearance: base-select; }
  /* в этом режиме стрелку рисует сам браузер (::picker-icon): фоновую убираем */
  body select:where(:not([multiple]):not([size])) { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px 0 14px; background-image: none; }
  body select:where(:not([multiple]):not([size]))::picker-icon { content: ""; flex: 0 0 auto; width: 16px; height: 16px; background: currentColor; opacity: .6; transition: rotate var(--adcm-dur-fast, .15s) ease;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
  body select:where(:not([multiple]):not([size])):open::picker-icon { rotate: 180deg; }
  body select:where(:not([multiple]):not([size])):open { border-color: var(--hoverColor, #2849a3); }

  /* раскрытый список */
  body select::picker(select) {
    margin: 6px 0; padding: 6px; min-width: anchor-size(width); max-width: min(92vw, 420px); max-height: min(60vh, 440px);
    border: 1px solid var(--borderColor, #e3e4ea); border-radius: 14px;
    background: var(--lightColor, #fff); color: var(--mainColor, #16202e);
    box-shadow: 0 14px 40px rgba(8, 11, 28, .16), 0 2px 6px rgba(8, 11, 28, .06);
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    opacity: 0; translate: 0 -4px; transition: opacity .14s ease, translate .14s ease, display .14s allow-discrete, overlay .14s allow-discrete;
  }
  body select:open::picker(select) { opacity: 1; translate: 0 0; }
  @starting-style { body select:open::picker(select) { opacity: 0; translate: 0 -4px; } }
  body select option { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 6px 12px; border-radius: 9px; font-size: var(--t-ui, .9rem); line-height: 1.3; cursor: pointer; white-space: normal; }
  body select option + option { margin-top: 2px; }
  body select option:is(:hover, :focus-visible) { background: var(--greyBg, #f2f3f6); outline: none; }
  body select option:checked { background: color-mix(in srgb, var(--hoverColor, #2849a3) 10%, transparent); font-weight: 600; }
  body select option:disabled { opacity: .45; cursor: default; }
  /* галочка у выбранного пункта справа */
  body select option::checkmark { order: 2; margin-left: auto; content: ""; width: 16px; height: 16px; flex: 0 0 auto; background: var(--hoverColor, #2849a3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / contain no-repeat; }
  body select optgroup { padding: 6px 0 2px; font-size: var(--t-meta, .75rem); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--adcmMuted, var(--greyColor, #666)); }
  html[data-theme="dark"] body select::picker(select) { background: var(--darkCard, #1b1f27); border-color: var(--darkBorder, #2a2f3a); color: var(--darkText, #dde3ec); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }
  html[data-theme="dark"] body select option:is(:hover, :focus-visible) { background: rgba(255, 255, 255, .08); }
  html[data-theme="dark"] body select option:checked { background: rgba(255, 255, 255, .12); }
  html[data-theme="dark"] body select option::checkmark { background: var(--darkText, #dde3ec); }
  @media (pointer: coarse) { body select option { min-height: 44px; } }
  @media (prefers-reduced-motion: reduce) { body select::picker(select) { transition: none; } }
}

/* выпадающее подменю в шапке: скруглены все четыре угла (были только нижние) и есть небольшой зазор от пункта */
body .nav-menu .sub-menu { border-radius: 14px; overflow: hidden; }
