:root {
  --container: 1120px;
  --gap: 18px;

  --bg: #fff;
  --surface: #181a1e;
  --surface-2: #1f2228;
  --text: #202020;
  --muted: rgba(85, 85, 85, 0.72);

  --accent: #c5a574;
  --accent-fade: rgba(197, 165, 116, 0.35);

  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  --r: 14px;
  --r2: 18px;

  --menu-w: 270px;
  --menu-bg: #1f2228;
  --menu-text: rgba(255, 255, 255, 0.92);
  --menu-muted: rgba(255, 255, 255, 0.62);
  --menu-accent: var(--accent, #c5a574);
  --menu-border: rgba(255, 255, 255, 0.08);
}
#uAdminBar {
  display: none;
}
body {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Ubuntu,
    Cantarell,
    Noto Sans,
    sans-serif;
  color: var(--text);
  background: var(--bg);
}

.page {
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Ubuntu,
    Cantarell,
    Noto Sans,
    sans-serif;
}

.layout {
  position: relative;
  min-height: 100%;
}

.black-header {
  background-color: #1f2228;
  width: 100%;
  height: 270px;
  position: absolute;
  z-index: -1;
}

.header {
  display: flex;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
}
.header__wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 0.5rem;
}
.menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  color: #fff;
}
.menu-button::before {
  content: "";
  border-style: solid;
  border-width: 2px 0;
  height: 12px;
  transition: border-color 0.2s ease;
  width: 22px;
}
.logo {
  color: #fff;
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  margin-left: 0.5rem;
}
.log-in {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  width: 40px;
  margin-left: auto;
  color: #fff;
}
.log-in svg {
  padding: 0.5rem;
}

.content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  background-color: #fff;
  border-radius: 1rem;
}

.tabs {
  width: 100%;
  max-width: none;
  margin: 0;

  display: flex;
  align-items: center;

  gap: 14px;
  padding: 12px 18px;
  margin-bottom: 32px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;

  justify-content: flex-start; /* ВАЖНО */
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs.is-centered {
  justify-content: center; /* включаем только если нет overflow */
}

/* вот магия: когда ВСЁ помещается — центрируем */
@media (min-width: 981px) {
  .tabs {
    /* “центр когда помещается” */
    justify-content: safe center;

    /* чтобы браузер не пытался центрировать за пределами scrollport */
    scroll-padding-inline: 18px;
  }

  /* но если есть переполнение — центр отключаем (fallback) */
  @supports selector(:has(*)) {
    .tabs:has(.tab__item:last-child) {
      justify-content: flex-start;
    }
  }
}

/* Тени по краям — показываем только когда реально скроллится (на десктопе они могут мешать).
   Проще: оставим на узких экранах. */
@media (max-width: 980px) {
  .tabs::before,
  .tabs::after {
    content: "";
    position: sticky;
    top: 0;
    width: 28px;
    height: 44px;
    align-self: center;
    pointer-events: none;
    z-index: 1;
  }

  .tabs::before {
    left: 0;
    background: linear-gradient(to right, var(--color-surface, #f2f3f5) 65%, transparent);
  }

  .tabs::after {
    right: 0;
    background: linear-gradient(to left, var(--color-surface, #f2f3f5) 65%, transparent);
  }
}

/* Ссылки */
.tab__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  text-decoration: none;
  color: #1f2228;

  /* как в рефе: “пилюля” без бордера */
  padding: 10px 14px;
  border-radius: 999px;

  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;

  transition:
    background 0.15s ease,
    color 0.15s ease;
  position: relative;
  z-index: 2;

  /* чтобы по клику не “съезжало” */
  scroll-snap-align: start;
}

/* hover */
.tab__item:hover,
.tab__item:focus-visible {
  background: rgba(31, 34, 40, 0.08);
  outline: none;
}

/* активная */
.tab__item.is-active,
.tab__item[aria-current="page"] {
  background: rgba(31, 34, 40, 0.12);
}

/* нормальная клавиатурная обводка */
.tab__item:focus-visible {
  outline: 2px solid rgba(31, 34, 40, 0.35);
  outline-offset: 2px;
}

/* Десктоп: если всё влезает — красиво по центру.
   Если не влезает — скролл остаётся и можно листать. */
@media (min-width: 981px) {
  .tabs {
    justify-content: center; /* как на рефе — “в одну линию” */
    gap: 14px;
    padding: 12px 18px;
  }
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
}

.muted {
  color: var(--muted);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(197, 165, 116, 0.18);
  border: 1px solid rgba(197, 165, 116, 0.25);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
}

.badge--soft {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ---- MENU ---- */
.menu {
  position: fixed;
  top: 0;
  left: 0;
  width: min(var(--menu-w), 86vw);
  height: 100dvh;
  z-index: 1000;

  background: var(--menu-bg);
  color: var(--menu-text);
  border-right: 1px solid var(--menu-border);
  padding: 14px 12px;
  overflow: auto;

  /* закрыто по умолчанию */
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  will-change: transform;
}

.menu.is-open {
  transform: translateX(0);
}

.menu__close:focus-visible,
.menu-button:focus-visible {
  outline: 2px solid rgba(197, 165, 116, 0.9);
  outline-offset: 2px;
}

.menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 10px;
}

.menu__title {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--menu-muted);
}

.menu__close {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;

  &:focus-visible {
    outline: 2px solid var(--menu-accent);
    outline-offset: 2px;
  }
}

.menu__nav + .menu__nav {
  margin-top: 10px;
}

.menu__list {
  display: grid;
  gap: 2px;
}

.menu__list--muted .menu__link {
  color: var(--menu-muted);
}

.menu__link {
  display: block;
  padding: 6px 10px 9px;
  border-radius: 8px;
  color: var(--menu-text);
  font-weight: 400;
  line-height: 1.15;
  transition:
    background 0.15s ease,
    color 0.15s ease;

  &:hover,
  &:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
  }

  &.is-active {
    background: rgba(197, 165, 116, 0.16);
    border: 1px solid rgba(197, 165, 116, 0.22);
  }
}

.menu__divider {
  margin: 12px 6px;
  height: 1px;
  background: var(--menu-border);
}

.menu__search {
  margin-top: 12px;
  padding: 0 4px 10px;
}

.menu__search-label {
  display: block;
  font-size: 12px;
  color: var(--menu-muted);
  margin: 0 0 8px;
}

.menu__search-row {
  display: flex;
  align-items: center;
  width: 100%;
  background-color: #fff;
  border-radius: 8px;
}

.menu__search-input {
  height: 40px;
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(15, 15, 15, 0.92);
  width: 100%;

  &::placeholder {
    color: rgba(255, 255, 255, 0.38);
  }

  &:focus-visible {
    outline: none;
  }
}

.menu__search-btn {
  height: 40px;
  color: #181a1e;
  width: 40px;
  cursor: pointer;
  font-size: 22px;

  &:hover {
    background: rgba(255, 255, 255, 0.12);
  }
  &:focus-visible {
    outline: none;
  }
}

/* ---- MOBILE: offcanvas ---- */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(3px);
}

@media (max-width: 980px) {
  .menu__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* состояние открыто */
  .menu.is-open {
    transform: translateX(0);
  }
}

/* Editor's choice block (BEM) */

.ec {
  --ec-h: clamp(260px, 46vw, 420px);
  --ec-gap: 0px;
  --ec-pad: clamp(16px, 2.2vw, 26px);
  --ec-text: rgba(255, 255, 255, 0.92);
  --ec-muted: rgba(255, 255, 255, 0.72);
  --ec-line: rgba(0, 0, 0, 0.12);

  width: 100%;
  margin-bottom: 22px;
  background: #1f2228 var(--ec-bg) no-repeat 50% 35% / cover;
  border-radius: 8px;
  overflow: hidden;
  background-attachment: scroll;
  will-change: transform;
}

/* grid */
.ec__grid {
  position: relative;
  height: var(--ec-h);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ec-gap);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

/* central divider like in ref */
.ec__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.05));
  transform: translateX(-0.5px);
  pointer-events: none;
}

/* item */
.ec__item {
  position: relative;
  display: block;
  color: var(--ec-text);
  text-decoration: none;
  outline: none;
}

.ec__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.25) 45%, rgba(0, 0, 0, 0) 70%), radial-gradient(circle at 50% 40%, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0) 60%);
  transition: background 0.2s ease;
}

.ec__content {
  position: absolute;
  inset: auto var(--ec-pad) var(--ec-pad);
}

.ec__tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  justify-content: center;
}

.ec__tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #1f2228;
}

.ec__headline {
  font-weight: 900;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.05;
  font-size: clamp(20px, 2.4vw, 34px);
  max-width: 80%;
  margin: 0 auto 10px;
  text-align: center;
}

.ec__meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  color: var(--ec-muted);
  justify-content: center;
}

.ec__by {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ec__date {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ec__stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* interactions */
.ec__item:hover .ec__shade,
.ec__item:focus-visible .ec__shade {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.06) 62%), linear-gradient(to right, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
}

.ec__item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: -2px;
}

/* responsive */
@media (max-width: 820px) {
  .ec__grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .ec__divider {
    width: 100%;
    height: 5px;
    left: 0;
    top: 50%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.15));
    height: 2px;
    backdrop-filter: blur(2px);
  }

  .ec__item:first-child .ec__shade {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0));
  }

  .ec__item:last-child .ec__shade {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0));
  }

  .ec__item {
    height: clamp(240px, 56vw, 360px);
  }
}

.cards {
  width: 100%;
  margin: 0 auto 28px;
}

.cards__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.2vw, 28px);
}

/* --- CARD --- */
.card {
  min-width: 0;
}

.card__link {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

/* image */
.card__media {
  margin: 0;
}

.card__img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9; /* аккуратно держит сетку */
  object-fit: cover;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 8px;
}

/* body */
.card__body {
  display: grid;
  gap: 8px;
}

.card__date {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55);
}

.card__title {
  margin: 0;
  font-weight: 850;
  line-height: 1.15;
  font-size: clamp(18px, 1.6vw, 22px);
  color: #1f2228;
}

.card__desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.72);

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* interactions (минимально, без “карточности”) */
.card__link:hover .card__title {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.card__link:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.65);
  outline-offset: 6px;
}

/* лёгкое ощущение “живости” на ховере */
@media (hover: hover) and (pointer: fine) {
  .card__img {
    transition: transform 0.25s ease;
  }
  .card__link:hover .card__img {
    transform: scale(1.02);
  }
}

/* responsive */
@media (max-width: 980px) {
  .cards__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .cards__grid {
    grid-template-columns: 1fr;
  }

  .card__desc {
    -webkit-line-clamp: 4;
  }
}

.article-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2.2rem;
  background-color: #fff;
  border-radius: 1rem;
}

.rubric-header {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}
.rubric-header__title {
  color: #181a1e;
}
.rubric-header__title::after {
  content: ":";
}
.rubric-header__container {
  font-weight: 400;
  font-size: 0.9rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
}
.rubric-header__link {
  padding: 4px 12px 6px;
  color: #999;
  border-radius: 2rem;
  transition: color 0.3s linear;
}
.rubric-header__link:hover {
  color: var(--accent);
}

.rubric-header__link.is-active {
  background-color: var(--accent);
  color: #181a1e;
  transition: color 0.3s linear;
}

.article-wrapper {
  display: flex;
  flex-direction: column;
}

.breadcrumbs {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
  margin-bottom: 1rem;

  .breadcrumbs__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .breadcrumbs__item {
    display: inline-flex;
    align-items: center;
  }

  .breadcrumbs__item:not(:last-child)::after {
    content: "/";
    margin: 0 6px;
    opacity: 0.6;
  }

  .breadcrumbs__link {
    transition: color 0.2s ease;
  }

  .breadcrumbs__link:hover,
  .breadcrumbs__link:focus-visible {
    color: var(--accent);
  }

  .breadcrumbs__item--current {
    font-weight: 500;
  }
}

.article__title {
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.225rem;
}

.article__subtitle {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1.625rem;

  font-size: var(--a-fs, 17px);
  line-height: var(--a-lh, 1.65);
  color: var(--a-text, rgba(255, 255, 255, 0.84));

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;

  overflow-wrap: anywhere;
}

.article__cover {
  margin-bottom: 1.625rem;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}

.article__cover-link {
  display: block;
  position: relative;
}

.article__cover-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease;
  aspect-ratio: 16 / 9;
}

.article__cover-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;

  padding: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));

  color: #fff;
}

:root {
  --a-max: 720px;

  --a-fs: 17px;
  --a-lh: 1.65;
  --a-vr: 22px;

  --a-text: rgba(29, 29, 29, 0.84);
  --a-title: rgba(14, 13, 13, 0.92);
  --a-muted: rgba(128, 128, 128, 0.62);
  --a-rule: rgba(255, 255, 255, 0.1);

  --a-link: #4da3ff;
  --a-link-visited: #8aa7ff;

  --a-code-bg: rgba(255, 255, 255, 0.06);
  --a-card: rgba(255, 255, 255, 0.04);
}

.article__body {
  max-width: var(--a-max, 720px);
  margin: 0 auto;

  font-size: var(--a-fs, 17px);
  line-height: var(--a-lh, 1.65);
  color: var(--a-text, rgba(255, 255, 255, 0.84));

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;

  overflow-wrap: anywhere;
}

.article__body p,
.article__body ul,
.article__body ol,
.article__body blockquote,
.article__body pre,
.article__body figure,
.article__body table {
  margin: 0 0 var(--a-vr, 22px);
}

.article__body p:empty {
  display: none;
}

/* часто WYSIWYG/редактор оставляет <p><br></p> */
.article__body p:has(br):not(:has(*)) {
  margin: 0;
}

.article__body h2,
.article__body h3,
.article__body h4 {
  margin: 0;
  color: var(--a-title, rgba(255, 255, 255, 0.92));
}

.article__body h2 {
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: calc(var(--a-vr, 22px) * 1.6) 0 calc(var(--a-vr, 22px) * 0.6);
}

.article__body h3 {
  font-size: 18px;
  line-height: 1.35;
  margin: calc(var(--a-vr, 22px) * 1.2) 0 calc(var(--a-vr, 22px) * 0.5);
}

.article__body h4 {
  font-size: 16px;
  line-height: 1.35;
  margin: calc(var(--a-vr, 22px) * 1) 0 calc(var(--a-vr, 22px) * 0.4);
  color: var(--a-title, rgba(255, 255, 255, 0.92));
  opacity: 0.92;
}

.article__body em {
  font-style: italic;
}
.article__body strong {
  font-weight: 600;
}

.article__body a {
  color: var(--a-link, #4da3ff);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.article__body a:visited {
  color: var(--a-link-visited, #8aa7ff);
}

.article__body a:hover {
  text-decoration-thickness: 0.12em;
}

.article__body a:focus-visible {
  outline: none;
  box-shadow: var(--a-focus, 0 0 0 3px rgba(197, 165, 116, 0.35));
  border-radius: 8px;
}

.article__body ul {
  list-style: none;
  padding-left: 0;
}

.article__body ul li {
  position: relative;
  padding-left: 22px;
  margin: 0.5em 0;
}

.article__body ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;

  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #c5a574);
}

.article__body ol {
  list-style: none;
  counter-reset: item;
  padding-left: 0;
}

.article__body ol li {
  counter-increment: item;
  position: relative;
  padding-left: 30px;
  margin: 0.5em 0;
}

.article__body ol li::before {
  content: counter(item) ".";
  position: absolute;
  left: 0;
  top: 0;

  font-weight: 600;
  color: var(--accent, #c5a574);
}

.article__body hr {
  border: 0;
  border-top: 1px solid var(--a-rule, rgba(255, 255, 255, 0.1));
  margin: calc(var(--a-vr, 22px) * 1.4) 0;
}

.article__body blockquote {
  padding: 12px 14px;
  border-left: 3px solid rgba(255, 255, 255, 0.18);
  background: var(--a-card, rgba(255, 255, 255, 0.04));
  color: rgba(255, 255, 255, 0.78);
  border-radius: 12px;
}

.article__body blockquote p {
  margin-bottom: 0;
}

.article__body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--a-radius);
}

.article__body table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #eee;
  overflow: hidden;
}

.article__body th,
.article__body td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  border-right: 1px solid #eee;
}

.article__body th {
  text-align: left;
  color: var(--a-title);
  font-size: 14px;
  background: rgba(0, 0, 0, 0.03);
}
