/* ========== Design tokens ========== */
/* public/assets/css/main.css */
:root {
  --container-max: 87.5rem;
  --container-pad: clamp(1rem, 0.8rem + 0.6vw, 1.25rem);

  --text-max: 62rem;
  --radius: 0.75rem;
  --ctrl: 2.25rem;

  --font: "Mulish", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --bg: #0f1115;
  --surface: #151924;
  --text: #e8eaf0;
  --muted: #aab0c0;
  --border: rgba(255, 255, 255, .10);
  --accent: #1199cf;

  --heading-color: var(--text);
  --heading-weight: 600;
  --heading-line: 1.18;

  --h1-size: clamp(2rem, 3.4vw, 2.85rem);
  --h2-size: clamp(1.55rem, 2.5vw, 2.1rem);
  --h3-size: clamp(1.25rem, 1.9vw, 1.4rem);
  --h4-size: 1.125rem;
  --h5-size: 1rem;
  --h6-size: 0.9375rem;

  --focus: 2px solid var(--accent);
  --focus-offset: 3px;
}

html[data-theme="light"] {
  --bg: #efefef;
  --surface: #f5f6f8;
  --text: #121317;
  --muted: #4d5566;
  --border: rgba(0, 0, 0, .10);
  --accent: #015ccb;
}

/* ========== Minimal reset (modern) ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  height: 100%;
}

/* public/assets/css/main.css */
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
}

/* ========== Home page ========== */

.home-page {
  width: 100%;
  display: grid;
  gap: 18px;
}


/* ========== A11y ========== */
.skip-link {
  position: absolute;
  left: 0;
  top: -100px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  color: var(--text);
  z-index: 9999;
}

.skip-link:focus {
  top: 12px;
  left: 12px;
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}

:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}

/* ========== Layout ========== */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .06);

  /* hide-on-scroll (mobile) */
  transition: transform .18s ease;
  will-change: transform;
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 56px;
}

.logo {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.logo__img {
  display: block;
  height: 36px;
  width: auto;
}

#main {
  scroll-margin-top: 70px;
}

.main {
  flex: 1 0 auto;
  padding: 20px 0 80px;
}

/* запас под bottom-nav */

.page__layout {
  display: block;
}

.page__main {
  max-width: var(--text-max);
  margin: 0 auto;
  min-width: 0;
}

.page__aside {
  display: none;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer__dev,
.footer__copy {
  color: var(--text);
  line-height: 1.35;
}

.footer__dev {
  text-align: left;
}

.footer__copy {
  text-align: right;
}

.footer__dev-link {
  color: var(--home-popular-badge-text);
  text-decoration: none;
  font-size: 15px;
}

html[data-theme="dark"] .footer__dev-link {
   color: var(--accent);
}

.footer__dev-link:hover {
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 991px) {
  .footer {
    padding: 18px 0 calc(18px + 72px + env(safe-area-inset-bottom, 0px));
  }

  .footer__inner {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .footer__dev,
  .footer__copy {
    width: 100%;
    text-align: left;
  }
}

/* figure по умолчанию имеет margin: 1em 40px — убираем */
figure {
  margin: 0;
}

/* Обложка: в ширину текста, выровнена как контент */
.material-cover {
  max-width: var(--text-max);
  margin: 0 0 14px;
  /* без auto */
}

.material-cover__img {
  width: 100%;
  height: auto;
}

/* ========== Header actions ========== */
.header__actions {
  margin-left: auto;
  display: flex;
  position: relative;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* ========== Theme toggle ========== */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: var(--ctrl);
  height: var(--ctrl);
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 0.625rem;
  cursor: pointer;
  flex: 0 0 auto;
}

.theme-toggle:hover {
  background: var(--bg);
}

.theme-toggle::before {
  content: "🌙";
  display: inline-block;
  font-size: 18px;
  line-height: 1;
}

html[data-theme="dark"] .theme-toggle::before {
  content: "☀️";
}

/* ========== Search btn ========== */
.header__search {
  display: inline-grid;
  place-items: center;
  width: var(--ctrl);
  height: var(--ctrl);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 0.625rem;
  text-decoration: none;
  flex: 0 0 auto;
}

.header__search:hover {
  background: var(--bg);
}

/* ========== Headings system ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  color: var(--heading-color);
  font-weight: var(--heading-weight);
  line-height: var(--heading-line);
  text-wrap: balance;
}

h1 {
  font-size: var(--h1-size);
}

h2 {
  font-size: var(--h2-size);
}

h3 {
  font-size: var(--h3-size);
}

h4 {
  font-size: var(--h4-size);
}

h5 {
  font-size: var(--h5-size);
}

h6 {
  font-size: var(--h6-size);
}

/* public/assets/css/main.css */
/* ========== Article typography ========== */
.article {
  max-width: var(--text-max);
}

.article__title {
  margin: 0 0 16px;
  line-height: 1.12;
}

.article__content,
.material-content,
.category-description,
.tag-page__content {
  font-size: 1em;
  line-height: 1.42;
  color: var(--text);
}

.article__content p,
.material-content p,
.category-description p,
.tag-page__content p {
  margin: 0 0 20px;
}

.article__content h2,
.material-content h2,
.category-description h2,
.tag-page__content h2 {
  margin: 36px 0 14px;
}

.article__content h3,
.material-content h3,
.category-description h3,
.tag-page__content h3 {
  margin: 28px 0 12px;
}

.article__content h4,
.article__content h5,
.article__content h6,
.material-content h4,
.material-content h5,
.material-content h6,
.category-description h4,
.category-description h5,
.category-description h6,
.tag-page__content h4,
.tag-page__content h5,
.tag-page__content h6 {
  margin: 22px 0 10px;
}

.article__content ul,
.article__content ol,
.material-content ul,
.material-content ol,
.category-description ul,
.category-description ol,
.tag-page__content ul,
.tag-page__content ol {
  margin: 0 0 20px 1.35rem;
  padding: 0;
}

.article__content li,
.material-content li,
.category-description li,
.tag-page__content li {
  margin: 8px 0;
}

.article__content a,
.material-content a,
.category-description a,
.tag-page__content a {
  color: var(--accent);
}

/* public/assets/css/main.css */
.article__content .table-responsive,
.material-content .table-responsive,
.category-description .table-responsive,
.tag-page__content .table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 22px 0;
}

.article__content table,
.material-content table,
.category-description table,
.tag-page__content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  font-size: 15px;
}

.article__content thead th,
.material-content thead th,
.category-description thead th,
.tag-page__content thead th,
.article__content tbody > tr:first-child > th,
.material-content tbody > tr:first-child > th,
.category-description tbody > tr:first-child > th,
.tag-page__content tbody > tr:first-child > th {
  background: var(--home-title);
  color: #fff;
}

html[data-theme="dark"] .article__content thead th,
html[data-theme="dark"] .material-content thead th,
html[data-theme="dark"] .category-description thead th,
html[data-theme="dark"] .tag-page__content thead th,
html[data-theme="dark"] .article__content tbody > tr:first-child > th,
html[data-theme="dark"] .material-content tbody > tr:first-child > th,
html[data-theme="dark"] .category-description tbody > tr:first-child > th,
html[data-theme="dark"] .tag-page__content tbody > tr:first-child > th {
  background: var(--home-title);
  color: #fff;
}

.article__content th,
.article__content td,
.material-content th,
.material-content td,
.category-description th,
.category-description td,
.tag-page__content th,
.tag-page__content td {
  padding: 12px 14px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.article__content th,
.material-content th,
.category-description th,
.tag-page__content th {
  font-weight: 700;
  color: var(--text);
}

.article__content td,
.material-content td,
.category-description td,
.tag-page__content td {
  color: var(--text);
}

/* public/assets/css/main.css */
.article__content tbody tr:nth-child(even) td,
.material-content tbody tr:nth-child(even) td,
.category-description tbody tr:nth-child(even) td,
.tag-page__content tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.035);
}

html[data-theme="dark"] .article__content tbody tr:nth-child(even) td,
html[data-theme="dark"] .material-content tbody tr:nth-child(even) td,
html[data-theme="dark"] .category-description tbody tr:nth-child(even) td,
html[data-theme="dark"] .tag-page__content tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.04);
}

/* public/assets/css/main.css */
.article__content tbody tr:hover td,
.material-content tbody tr:hover td,
.category-description tbody tr:hover td,
.tag-page__content tbody tr:hover td {
  background: rgba(77, 46, 49, 0.03);
  transition: background-color 0.18s ease;
}

html[data-theme="dark"] .article__content tbody tr:hover td,
html[data-theme="dark"] .material-content tbody tr:hover td,
html[data-theme="dark"] .category-description tbody tr:hover td,
html[data-theme="dark"] .tag-page__content tbody tr:hover td {
  background: rgba(174, 59, 71, 0.03);
}

.article__content caption,
.material-content caption,
.category-description caption,
.tag-page__content caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 10px;
  font-weight: 600;
  color: var(--text);
}

/* ========== UI text defaults (outside article content) ========== */
.page ul,
.page ol {
  margin: 0;
  padding-left: 14px;
}

/* ========== TOP NAV (desktop) ========== */
/* ВАЖНО: скрываем top-nav на мобилке по умолчанию */
.nav--top {
  display: none;
}

/* перебиваем общий .page ul/.page ol */
.page .nav__list {
  padding-left: 0;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;

  flex-wrap: nowrap;
  /* всегда в одну строку */
}

.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;

  line-height: 1;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 8px;
  border-radius: 0.625rem;
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav__link--active {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* стрелка у пунктов с детьми */
.nav__item--has-children>.nav__link::after {
  content: "▾";
  margin-left: 0.1rem;
  font-size: 1.2em;
  line-height: 1;
  opacity: .75;
  display: inline-block;
  transform: translateY(1px);
  transform-origin: 50% 55%;
  transition: transform 160ms ease;
}

.nav__item--has-children:hover>.nav__link::after,
.nav__item--has-children:focus-within>.nav__link::after {
  transform: translateY(1px) rotate(180deg);
}

/* dropdown */
.nav__sublist {
  position: absolute;
  top: 100%;
  left: 0;

  min-width: 18rem;
  list-style: none;
  margin: 0;
  padding: .5rem;

  display: none;
  z-index: 1000;

  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.nav__item--has-children:hover>.nav__sublist,
.nav__item--has-children:focus-within>.nav__sublist {
  display: block;
}

.nav__subitem {
  margin: 0;
}

.nav__sublink {
  display: block;
  padding: 10px 12px;
  border-radius: 0.625rem;
  text-decoration: none;
  color: var(--muted);
  line-height: 1.2;
}

.nav__sublink:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .06);
}

.nav__sublink--active {
  color: var(--text);
  background: rgba(255, 255, 255, .08);
}

/* ========== Bottom nav (mobile) ========== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.bottom-nav__list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  gap: 8px;
}

.bottom-nav__link {
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 10px 0;
}

.bottom-nav__link--active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(36, 87, 255, .18);
}

/* ========== Breadcrumbs ========== */
.breadcrumbs {
  margin: 0 0 12px;
}

.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumbs__item::after {
  content: "›";
  margin-left: 6px;
  color: var(--muted);
}

.breadcrumbs__item:last-child::after {
  content: "";
  margin: 0;
}

.breadcrumbs__link {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs__link:hover {
  color: var(--text);
  text-decoration: underline;
}

.breadcrumbs__current {
  color: var(--text);
}

.content {
  display: grid;
  gap: 14px;
}

/* ========== Aside widgets ========== */
.aside {
  display: grid;
  gap: 14px;
}

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.widget__body {
  padding: 14px;
}

.widget__text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.aside {
  display: grid;
  gap: 14px;
}

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.widget__body {
  padding: 14px;
}

.widget__text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ========== Social follow block ========== */
.social-follow-block {
  overflow: hidden;
}

.social-follow-block--mobile {
  margin-top: 24px;
}

.social-follow {
  width: 100%;
}

.social-follow__title {
  margin: 0;
  padding: 18px 18px 16px;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.25;
  font-weight: 500;
}

.social-follow__list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.social-follow__item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  padding: 0 18px;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8125rem;
  line-height: 1.2;
  font-weight: 700;
  transition: transform 0.15s ease, filter 0.15s ease;
  border-radius: 5px;
}

.social-follow__item:hover {
  color: #fff;
  filter: brightness(1.05);
}

.social-follow__icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
}

.social-follow__icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}

.social-follow__label {
  display: inline-block;
}

.social-follow__item--facebook {
  background: #486ab3;
}

.social-follow__item--telegram {
  background: #3c9fd5;
}

.social-follow__item--instagram {
  background: #3b6ea5;
}

.social-follow__item--x {
  background: #111111;
}

.social-follow__item--youtube {
  background: #ff1200;
}



/* ========== Content copy protection ========== */
/* Запрещаем выделение только у текстового контента, а не у всей страницы */

.article__content p,
.article__content li,
.article__content table,
.article__content th,
.article__content td,
.article__content blockquote,
.material-content p,
.material-content li,
.material-content table,
.material-content th,
.material-content td,
.material-content blockquote,
.category-description p,
.category-description li,
.category-description table,
.category-description th,
.category-description td,
.tag-page__content p,
.tag-page__content li,
.tag-page__content table,
.tag-page__content th,
.tag-page__content td {
  -webkit-user-select: none;
  user-select: none;
}

/* ========== A11y panel ========== */
.a11y-btn {
  display: inline-grid;
  place-items: center;
  width: var(--ctrl);
  height: var(--ctrl);
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  flex: 0 0 auto;
}

.a11y-btn:hover {
  background: var(--bg);
}

.a11y-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  gap: 10px;
  z-index: 999;
}

.a11y-panel[hidden] {
  display: none;
}

.a11y-panel__row {
  display: flex;
  gap: 8px;
}

.a11y-panel__btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
}

.a11y-panel__btn[aria-pressed="true"] {
  border-color: var(--accent);
}

/* ========== Font scaling (НЕ трогаем html font-size) ========== */
/* FIX: базовый размер html не меняем */
html[data-font="sm"],
html[data-font="md"],
html[data-font="lg"] {
  font-size: 100%;
}

/* Масштаб через переменную */
:root {
  --font-scale: 1;
}

html[data-font="sm"] {
  --font-scale: 1;
}

html[data-font="md"] {
  --font-scale: 1.125;
}

html[data-font="lg"] {
  --font-scale: 1.25;
}

.main,
.nav,
.bottom-nav {
  font-size: calc(1rem * var(--font-scale));
}

button,
input,
select,
textarea {
  font-size: 1em;
}

/* ========== High contrast mode ========== */
html[data-contrast="high"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --muted: #000000;
  --border: #000000;
  --accent: #0000ee;
  --focus: 3px solid #000000;
}

html[data-contrast="high"] .header,
html[data-contrast="high"] .bottom-nav,
html[data-contrast="high"] .footer,
html[data-contrast="high"] .widget,
html[data-contrast="high"] .card,
html[data-contrast="high"] .nav__sublist,
html[data-contrast="high"] .a11y-panel,
html[data-contrast="high"] .more__panel,
html[data-contrast="high"] .article__content table,
html[data-contrast="high"] .material-cover__img,
html[data-contrast="high"] .material-cover__video,
html[data-contrast="high"] .card__img {
  border-color: #000000;
  box-shadow: none;
}

html[data-contrast="high"] .nav__link,
html[data-contrast="high"] .nav__sublink,
html[data-contrast="high"] .bottom-nav__link,
html[data-contrast="high"] .header__search,
html[data-contrast="high"] .theme-toggle,
html[data-contrast="high"] .a11y-btn,
html[data-contrast="high"] .a11y-panel__btn,
html[data-contrast="high"] .more__link,
html[data-contrast="high"] .more__sublink,
html[data-contrast="high"] .more__toggle,
html[data-contrast="high"] .tag,
html[data-contrast="high"] .pagination__link {
  background: #ffffff;
  color: #000000;
  border-color: #000000;
}

html[data-contrast="high"] .nav__link--active,
html[data-contrast="high"] .nav__sublink--active,
html[data-contrast="high"] .bottom-nav__link--active,
html[data-contrast="high"] .more__link--active,
html[data-contrast="high"] .more__sublink--active,
html[data-contrast="high"] .pagination__current {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
  box-shadow: none;
}

html[data-contrast="high"] a {
  color: #0000ee;
  text-decoration: underline;
}

html[data-contrast="high"] .article__content a,
html[data-contrast="high"] .material-share a, {
color: #0000ee;
}

html[data-contrast="high"] .a11y-panel__contrast[aria-pressed="true"] {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

html[data-contrast="high"] .social-follow-block {
  border-color: #000000;
  box-shadow: none;
}

html[data-contrast="high"] .social-follow__item {
  background: #ffffff !important;
  color: #000000 !important;
  border-top: 2px solid #000000;
}

html[data-contrast="high"] .social-follow__item:first-child {
  border-top: 0;
}

/* ========== More overlay ========== */
/* Prevent background scroll when overlay is open */
.page--no-scroll {
  overflow: hidden;
}

.more {
  position: fixed;
  inset: 0;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.more--open {
  opacity: 1;
  pointer-events: auto;
}

.more__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.more__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;

  padding: 14px;
  transform: translateY(14px);
  transition: transform 0.15s ease;
}

.more--open .more__panel {
  transform: translateY(0);
}

.more__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.more__title {
  font-weight: 700;
  color: var(--text);
}

.more__close {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
}

.more__nav {
  margin-top: 12px;
}

.more__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.more__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.more__link {
  flex: 1;
  display: block;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.more__link--active {
  border-color: var(--accent);
}

/* screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* accordion toggle */
.more__toggle {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.more__toggle::before {
  content: "▾";
  font-size: 1rem;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}

.more__toggle[aria-expanded="true"]::before {
  transform: rotate(0deg);
}

.more__sublist {
  list-style: none;
  margin: 0.5rem 0 0 0;
  padding: 0 0 0 1rem;
  display: grid;
  gap: 0.5rem;
  border-left: 1px solid var(--border);
}

.more__sublist[hidden] {
  display: none;
}

.more__sublink {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
}

.more__sublink--active {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

/* ========== Material cards + pagination ========== */

.cards {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.card {
  display: block;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--home-card-shadow);
  border-radius: 6px;
}

html[data-theme="dark"] .card {
    background: rgba(255, 255, 255, 0.04);
}

.card:first-child {
  border-top: 1px solid var(--border);
}

.card__media {
  display: none;
  /* mobile: без превью */
}

.card__img {
  width: 120px;
  height: 110px;
  object-fit: cover;
  border-radius: 0.2rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.card__body {
  min-width: 0;
  padding: 6px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.25;
}

.card__title a {
  color: var(--text);
  text-decoration: none;
}

.card__title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--muted);
}

.card__type {
  color: var(--text);
}

.card__date strong {
  color: var(--text);
  font-weight: 600;
}

.card__sep {
  color: var(--muted);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.pagination__link,
.pagination__current,
.pagination__dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: 0.3rem;
  border: 1px solid var(--border);
  text-decoration: none;
}

.pagination__link {
  color: var(--text);
  background: var(--surface);
}

.pagination__link:hover {
  border-color: var(--home-popular-badge-text);
  color: var(--text);
}

.pagination__current {
  color: #fff;
  background: var(--home-popular-badge-text);
  border-color: var(--home-popular-badge-text);
}

.pagination__dots {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 0.25rem;
  min-width: auto;
}

/* ========== Material page spacing ========== */

.material-page {
  max-width: var(--text-max);
}

.material-page__title {
  margin: 0 0 10px;
}

.material-meta--top {
  margin: 0 0 18px;
}

.material-meta__dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.material-meta__date strong {
  color: var(--text);
  font-weight: 600;
}

.material-meta__sep {
  color: var(--muted);
}

.material-cover {
  margin: 0 0 22px;
}

.material-cover__img,
.material-cover__video {
  width: 100%;
  height: auto;
  border-radius: 0.2rem;
  overflow: hidden;
}

.material-content {
  margin: 0 0 24px;
  border: 1px solid var(--border);
  background: #ffffff52;
  border-radius: 6px;
  padding: 20px 22px;
}

html[data-theme="dark"] .material-content {
   background: #3a415626;
}

.material-content p {
  margin: 0 0 18px;
}

.material-content ul,
.material-content ol {
  margin: 0 0 20px;
  padding-left: 1.35rem;
}

.material-content li {
  margin: 10px 0;
}

.material-content > *:last-child {
  margin-bottom: 0;
}

.material-meta--bottom {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.meta__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--text);
}

.material-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  color: var(--muted);
  margin: 20px 10px 10px 12px;
}

.material-share strong {
  color: var(--text);
}

.material-share a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1.06em;
}

.material-share a:hover {
  text-decoration: underline;
}

/* ========== Home layout: full width without sidebar ========== */

.page__layout--home .page__main,
.page__layout--home .article {
  max-width: none;
  width: 100%;
}

/* ========== /eshhe fallback page ========== */
.more-page {
  width: 100%;
  max-width: 48rem;
}

.more-page__nav {
  width: 100%;
}

.more-page__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.more-page__item {
  margin: 0;
}

.more-page__link {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.more-page__link:hover {
  border-color: var(--accent);
  color: var(--text);
}

.more-page__link--active {
  border-color: var(--accent);
}





/* ========== Mobile: hide header on scroll down ========== */
@media (max-width: 991px) {
  .header.header--hidden {
    transform: translateY(-100%);
  }
}

/* ========== Breakpoints ========== */
@media (min-width: 992px) {
  .nav--top {
    display: block;
  }

  .bottom-nav {
    display: none;
  }

  .main {
    padding-bottom: 20px;
  }

  .article__content,
  .material-content,
  .category-description,
  .tag-page__content {
    font-size: 1.0625em;
  }

  .card {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }

  .card__media {
    display: block;
  }

  .material-page__title {
    margin-bottom: 12px;
  }

  .material-meta--top {
    margin-bottom: 20px;
  }

  .material-cover {
    margin-bottom: 26px;
  }

  .material-content {
    margin-bottom: 28px;
  }

  .material-meta--bottom {
    gap: 16px;
    padding-top: 20px;
  }

  .more-page__list {
    gap: 12px;
  }

}

@media (max-width: 1199px) {
  .social-follow-block--sidebar {
    display: none;
  }
}

@media (min-width: 1200px) {
  .page__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 355px;
    gap: 22px;
    align-items: start;
  }

  .page__aside {
    display: block;
    min-width: 0;
  }

  .page__main {
    width: 100%;
    max-width: none;
    margin: 0;
    min-width: 0;
  }

  .page__layout--home {
    display: block;
  }

  .social-follow-block--mobile {
    display: none;
  }

}

@media (min-width: 1440px) {
  .page__layout {
    grid-template-columns: minmax(0, 1fr) 365px;
    gap: 23px;
  }
}


/* Home design tokens */
:root {
  --home-title: #b51d2d;

  --home-hero-bg: url("/assets/img/background-mobile.png");

  --home-card-bg: #ffffff;
  --home-card-border: #e6e6e6;
  --home-card-shadow:
    0px 3px 8px 0px rgba(0, 0, 0, 0.1019607843),
    0px 6px 14px 0px rgba(0, 0, 0, 0.0509803922),
    0px 31px 19px 0px rgba(0, 0, 0, 0.0509803922),
    0px 55px 22px 0px rgba(0, 0, 0, 0.0117647059),
    0px 87px 24px 0px rgba(0, 0, 0, 0),
    0px 2px 0px 0px #dadada;

  --home-hero-btn-bg: linear-gradient(180deg, #b51d2d 0%, #cf3949 100%);
  --home-hero-btn-shadow:
    0px 3.71px 4.85px 0px rgb(255 0 0 / 6%),
    0px 10.27px 13.4px 0px rgb(255 12 0 / 10%),
    0px 24.72px 32.26px 0px rgb(255 120 120 / 10%),
    0px 1px 4px 2px #ffdbdba6 inset,
    0px 1px 18px 2px #ffdbdb00 inset;

  --home-tool-pill-bg: #e6e6e6;
  --home-tool-pill-shadow:
    0px 1.5px 0px 0px #ffffff,
    inset 0px 0px 3px 0px rgba(0, 0, 0, 0.3215686275);

  --home-popular-bg: rgb(39, 39, 39);
  --home-popular-card-bg: #222222;
  --home-popular-text: #ffffff;
  --home-popular-muted: rgba(255, 255, 255, 0.72);

  --home-popular-badge-text: #b51d2d;
  --home-popular-badge-shadow:
    0px 1.5px 0px 0px rgba(255, 255, 255, 0.3),
    0px 0px 3px 0px rgba(0, 0, 0, 0.4) inset;
}

html[data-theme="dark"] {
  --home-card-bg: #151924;
  --home-card-border: rgba(255, 255, 255, 0.10);
  --home-card-shadow: 0 12px 28px rgba(0, 0, 0, 0.40);

  --home-tool-pill-bg: rgba(255, 255, 255, 0.10);
  --home-tool-pill-shadow: inset 0px 0px 3px 0px rgba(0, 0, 0, 0.45);
}

@media (min-width: 992px) {
  :root {
    --home-hero-bg: url("/assets/img/background-desktop.png");
  }
}

/* HERO */
.home-hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background:
    var(--home-hero-bg) center top / cover no-repeat,
    #efefef;
  box-shadow: none;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.22) 0%,
      rgba(255, 255, 255, 0.38) 48%,
      rgba(255, 255, 255, 0.26) 100%);
  pointer-events: none;
}

.home-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 980px;
  min-height: 360px;
  margin: 0 auto;
  padding: 52px 20px 20px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
}

.home-hero__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: max-content;
  padding: 10px 18px;
  border-radius: 32px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  color: var(--home-title);
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
  box-shadow: var(--home-card-shadow);
}

.home-hero__title {
  margin: 0;
  max-width: 28ch;
  font-size: clamp(2.1rem, 4.1vw, 2.5rem);
  font-weight: 700;
  line-height: 1.08;
  color: var(--text);
  text-wrap: balance;
}

.home-hero__text {
  max-width: 820px;
  font-size: 1.02em;
  line-height: 1.3;
  color: var(--text);
  text-align: center;
}

.home-hero__text.article__content p:last-child {
  margin-bottom: 0;
}

.home-hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.home-hero__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.home-hero__action--primary {
  background: var(--home-hero-btn-bg);
  color: #ffffff;
  box-shadow: var(--home-hero-btn-shadow);
}

.home-hero__action--secondary {
  background: rgb(243 243 243);
  color: var(--home-title);
  border-color: #b23945;
  box-shadow: var(--home-hero-btn-shadow);
}

.home-hero__action:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
}

/* OVERVIEW */
.home-overview {
  width: 100%;
}

.home-overview__grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

.home-overview__col {
  display: grid;
  gap: 16px;
}

/* Topic cards */
.home-topic-card {
  border-radius: 16px;
  background: var(--home-card-bg);
  border: 1px solid var(--home-card-border);
  box-shadow: var(--home-card-shadow);
  overflow: hidden;
}

.home-topic-card__link {
  display: grid;
  min-height: 168px;
  gap: 8px;
  padding: 18px 12px 12px 24px;
  text-decoration: none;
  color: var(--text);
}

.home-topic-card__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--home-title);
  flex: 0 0 auto;
}

.home-topic-card__svg {
  width: 48px;
  height: 48px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-theme="dark"] .home-topic-card__icon {
  color: var(--home-title);
}

.home-topic-card__title {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  text-wrap: balance;
}

.home-topic-card__text {
  margin: 0;
  font-size: 0.96875em;
  line-height: 1.42;
  color: var(--muted);
}

/* Latest */
.home-latest {
  border-radius: 1px;
  background: var(--home-card-bg);
  border: 1px solid var(--home-card-border);
  box-shadow: var(--home-card-shadow);
  overflow: hidden;
}

html[data-theme="light"] .home-latest {
  background: #efefef;
}

.home-latest__head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--home-card-border);
}

.home-latest__title {
  margin: 0;
  font-size: 1.25em;
  line-height: 1.2;
  color: var(--text);
  font-weight: 600;
}

.home-latest__scroll {
  max-height: 420px;
  overflow: auto;
}

.home-latest__list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.home-latest-item {
  border-radius: 6px;
  border: 1px solid var(--home-card-border);
  background: rgb(255 255 255 / 20%);
  overflow: hidden;
  box-shadow: var(--home-card-shadow);
}

html[data-theme="dark"] .home-latest-item {
  background: rgba(255, 255, 255, 0.04);
}

.home-latest-item__link {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  text-decoration: none;
  color: var(--text);
}

.home-latest-item__thumb {
  display: block;
  width: 92px;
  height: 92px;
  overflow: hidden;
  background: var(--surface);
}

.home-latest-item__img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  display: block;
}

.home-latest-item__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(181, 29, 45, 0.12), rgba(181, 29, 45, 0.03));
}

.home-latest-item__body {
  display: grid;
  gap: 4px;
  padding: 8px 8px 4px 0;
  min-width: 0;
}

.home-latest-item__meta {
  font-size: 0.75em;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--home-title);
  font-weight: 700;
}

.home-latest-item__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}

.home-latest-item__title {
  font-size: 0.84em;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}

.home-latest-item__date {
  font-size: 0.78125em;
  line-height: 1.3;
  color: var(--muted);
}

.home-latest-item__link:hover .home-latest-item__title {
  color: var(--accent);
}

/* База для desktop: узкий desktop (992–1199) */
@media (min-width: 992px) {
  .home-overview__grid {
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 400px) minmax(280px, 1fr);
  }
}

/* Обычный desktop (1200–1599) */
@media (min-width: 1200px) {
  .home-overview__grid {
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 440px) minmax(280px, 1fr);
  }
}

/* Широкий desktop (>=1600) — как на 1920, центр шире */
@media (min-width: 1600px) {
  .home-overview__grid {
    grid-template-columns: 1fr minmax(360px, 520px) 1fr;
  }
}

/* ===== HOME: overview equal-height columns (desktop) ===== */
@media (min-width: 992px) {
  .home-overview {
    --home-overview-height: 665px;
  }

  .home-overview__col {
    height: var(--home-overview-height);
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  .home-topic-card {
    height: 100%;
  }

  .home-topic-card__link {
    height: 100%;
    align-content: start;
  }

  .home-latest {
    height: var(--home-overview-height);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .home-latest__scroll {
    max-height: none;
    min-height: 0;
  }
}

/* Calendar CTA */
.home-calendar-cta {
  padding: 8px;
  display: flex;
  justify-content: center;
  background: transparent;
  border: 0;
}

.home-calendar-cta__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 30px;
  text-decoration: none;
  font-size: 24px;
  font-weight: 600;
  color: var(--home-title);
  background: var(--home-card-bg);
  border: 1px solid var(--home-card-border);
  box-shadow: var(--home-card-shadow);
}

html[data-theme="dark"] .home-calendar-cta__link {
  color: #ffffff;
}

/* Tools */
.home-tools {
  display: grid;
  gap: 16px;
}

/* public/assets/css/main.css */
/* HOME tools: normalize short pills (НДФЛ/НДС) */
.home-tools__grid>.home-tool-card:nth-child(1) .home-tool-card__text,
.home-tools__grid>.home-tool-card:nth-child(2) .home-tool-card__text {
  min-width: 116px;
  /* можно 88–104px, подстрой по вкусу */
  justify-content: center;
  /* на всякий случай */
}

.home-tools__head {
  padding: 0 2px;
}

.home-tools__title {
  margin: 0 0 10px 0;
  font-size: 2em;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
  color: var(--text);
}

.home-tools__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.home-tool-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.home-tool-card__link {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 0;
  text-align: center;
  text-decoration: none;
  color: var(--text);
}

.home-tool-card__icon {
  width: 104px;
  height: 104px;
  border-radius: 16px;
  background: var(--home-card-bg);
  border: 1px solid var(--home-card-border);
  box-shadow: var(--home-card-shadow);
  display: grid;
  place-items: center;
  color: var(--home-title);
}

.home-tool-card__svg {
  width: 64px;
  height: 64px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-tool-card__title {
  font-size: 1em;
  line-height: 1.25;
  font-weight: 600;
  text-wrap: balance;
  color: var(--text);
}

.home-tool-card__text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 2px 14px;
  border-radius: 32px;
  background: var(--home-tool-pill-bg);
  box-shadow: var(--home-tool-pill-shadow);
  color: var(--muted);
  font-size: 0.84375em;
  line-height: 1.2;
  max-width: max-content;
  text-align: center;
}

.home-tool-card__link:hover .home-tool-card__title {
  color: var(--accent);
}

/* Popular */
.home-popular {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: var(--home-popular-bg);
  overflow: hidden;
}

html[data-theme="dark"] .home-popular {
  background: transparent;
}

.home-popular__inner {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.home-popular__title {
  margin: 0;
  color: var(--home-popular-text);
  font-size: 2em;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.home-popular__scroll {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 560px;
}

.home-popular__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.home-popular-card {
  min-width: 0;
  background: var(--home-popular-card-bg);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin: 15px 15px 10px 15px;
}

.home-popular-card__link {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  height: 100%;
  text-decoration: none;
  color: var(--home-popular-text);
}

.home-popular-card__image-wrap {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  padding: 2px 24px 28px 24px;
}

.home-popular-card__image,
.home-popular-card__placeholder {
  border-radius: 6px;
  overflow: hidden;
  display: block;
  width: 100%;
}

.home-popular-card__image {
  object-fit: cover;
  height: auto;
}

.home-popular-card__placeholder {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
}

.home-popular-card__body {
  padding: 28px 28px 18px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
}

.home-popular-card__badge {
  display: inline-block;
  max-width: max-content;
  padding: 10px 18px;
  border-radius: 32px;
  box-shadow: var(--home-popular-badge-shadow);
  color: var(--home-popular-badge-text);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.home-popular-card__title {
  font-size: 1.2em;
  font-weight: 600;
  line-height: 1.32;
  margin: 0;
}

.home-popular-card__date {
  margin-top: -2px;
  color: var(--home-popular-muted);
}

/* Home bottom note + links */
.home-note {
  width: 100%;
  margin-top: 18px;
}

.home-note,
.home-links {
  width: 100%;
}

.home-note__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

.home-links__inner {
  width: min(calc(100% - (var(--container-pad) * 2)), var(--container-max));
  margin: 0 auto;
  border-radius: 32px;
  border: 1px solid var(--home-card-border);
  background: var(--home-card-bg);
  box-shadow: var(--home-card-shadow);
}

.home-note__text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 72px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--home-card-border);
  background: var(--home-card-bg);
  color: var(--home-title);
  text-align: center;
  font-size: 1em;
  line-height: 1.55;
  box-shadow: var(--home-card-shadow);
}

html[data-theme="dark"] .home-note__text {
  color: #ffffff;
}

.home-links__grid {
  display: grid;
  gap: 18px;
  padding: 18px 0 0;
}

.home-links__col {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 20px 18px;
}

.home-links__col--social {
  justify-content: flex-start;
}

.home-links__social-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-links__social-item {
  margin: 0;
}

.home-links__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text);
  text-decoration: none;
}

.home-links__social-link svg {
  width: 28px;
  height: 28px;
  display: block;
  fill: currentColor;
}

.home-links__social-link:hover {
  color: var(--accent);
}

.home-links__link {
  color: var(--text);
  text-decoration: none;
  text-align: center;
  line-height: 1.35;
  font-weight: 500;
}

.home-links__link:hover {
  color: var(--accent);
}

.site-bottom {
  display: grid;
  gap: 18px;
  padding: 0 0 24px;
}

@media (min-width: 992px) {
  .home-note {
    margin-top: 24px;
  }

  .home-note__text {
    min-height: 78px;
    padding: 20px 36px;
    font-size: 1.02rem;
  }

  .home-links__grid {
    grid-template-columns: 222px 158px minmax(214px, 1fr) minmax(214px, 1fr);
    gap: 12px;
    padding: 24px 18px;
  }

  .home-links__col {
    min-height: 108px;
    padding: 18px 10px;
  }

  .home-links__social-list {
    flex-wrap: nowrap;
    gap: 10px;
  }

  .site-bottom {
    gap: 22px;
    padding-bottom: 28px;
  }

}

@media (min-width: 992px) and (max-width: 1199px) {
  .home-links__grid {
    grid-template-columns: 200px 145px minmax(205px, 1fr) minmax(205px, 1fr);
    gap: 12px;
    padding: 24px 20px;
  }

  .home-links__col {
    min-height: 96px;
    padding: 16px 12px;
  }

  .home-links__col--social {
    justify-content: flex-start;
  }

  .home-links__social-list {
    gap: 14px;
  }

  .home-links__link {
    font-size: 0.94em;
    white-space: nowrap;
  }
}

@media (max-width: 991px) {
  .home-note__text {
    min-height: 0;
    padding: 16px 18px;
    border-radius: 16px;
  }

  .home-links__grid {
    grid-template-columns: 1fr;
    padding: 20px 18px;
  }

  .home-links__col {
    min-height: 0;
    justify-content: center;
    text-align: center;
  }

  .home-links__col--social {
    justify-content: center;
  }
}

/* Desktop */
@media (min-width: 992px) {
  .home-page {
    gap: 58px;
  }

  .home-hero__inner {
    min-height: 500px;
    padding: 72px 24px 82px;
  }

  .home-overview__grid {
    gap: 20px;
  }

  .home-latest-item__link {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .home-latest-item__thumb,
  .home-latest-item__img {
    width: 104px;
    height: 96px;
  }

  .home-calendar-cta__link {
    min-width: 420px;
  }

  .home-tools__grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .home-tool-card__icon {
    width: 112px;
    height: 112px;
  }

  .home-popular__inner {
    padding: 26px;
  }

  .home-popular__title {
    font-size: 2.2em;
  }

  .home-popular__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-popular__scroll {
    height: 500px;
    max-height: none;
  }
}


@media (max-width: 991px) {
  .home-hero {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    border-radius: 16px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: var(--home-card-shadow);
  }

  .home-hero__inner {
    min-height: 0;
  }

  .home-hero__title {
    max-width: 16ch;
  }

  .home-tools__title,
  .home-popular__title {
    font-size: 1.7rem;
  }
}

/* Dark theme tuning */
html[data-theme="dark"] .home-hero {
  background:
    var(--home-hero-bg) center top / cover no-repeat,
    #0b0f17;
}

html[data-theme="dark"] .home-hero::before {
  background:
    linear-gradient(180deg,
      rgba(6, 8, 13, 0.56) 0%,
      rgba(6, 8, 13, 0.34) 48%,
      rgba(6, 8, 13, 0.56) 100%);
}

html[data-theme="dark"] .home-hero__badge {
  background: rgba(20, 24, 34, 0.72);
  border-color: rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

html[data-theme="dark"] .home-hero__action--secondary {
  background: rgba(20, 24, 34, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

html[data-theme="dark"] .home-hero__title,
html[data-theme="dark"] .home-hero__text {
  color: #f3f4f7;
}

/* High contrast */
html[data-contrast="high"] .home-hero,
html[data-contrast="high"] .home-topic-card,
html[data-contrast="high"] .home-latest,
html[data-contrast="high"] .home-popular-card {
  box-shadow: none;
}

html[data-contrast="high"] .home-popular {
  background: #ffffff;
}

html[data-contrast="high"] .home-popular__title,
html[data-contrast="high"] .home-popular-card__title,
html[data-contrast="high"] .home-popular-card__date {
  color: #000000 !important;
}

html[data-contrast="high"] .home-popular-card {
  background: #ffffff !important;
  border-color: #000000 !important;
}

html[data-contrast="high"] .home-popular-card__badge {
  background: #ffffff !important;
  color: #000000 !important;
  box-shadow: none !important;
  border: 2px solid #000000;
}

html[data-contrast="high"] .home-tool-card__icon {
  box-shadow: none !important;
  border: 2px solid #000000 !important;
  background: #ffffff !important;
}

html[data-contrast="high"] .home-tool-card__text {
  box-shadow: none !important;
  border: 2px solid #000000;
  background: #ffffff !important;
  color: #000000 !important;
}

.home-overview--info {
  max-width: 61em;
}

.home-overview--info .home-overview__col--info {
  height: auto;
  grid-template-rows: none;
}

.home-overview--info .home-topic-card,
.home-overview--info .home-topic-card__link {
  height: auto;
}

@media (min-width: 992px) {
  .home-overview--info .home-overview__col--info {
    height: auto;
    grid-template-rows: none;
  }

  .home-overview--info .home-topic-card,
  .home-overview--info .home-topic-card__link {
    height: auto;
  }
}

/* public/assets/css/main.css */
/* ========== Calculators ========== */

.calc-card {
  margin: 24px 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] .calc-card {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.calc-card__title {
  margin: 0 0 16px;
  font-size: 1.375em;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

.calc-card__intro {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.calc-form {
  display: grid;
  gap: 16px;
}

.calc-form__grid {
  display: grid;
  gap: 16px;
}

.calc-form__field {
  display: grid;
  gap: 8px;
}

.page-narrow {
  max-width: 860px;
  margin: 0 auto;
}

.contacts-page__title {
  width: 80%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.contacts-form {
  width: 80%;
  max-width: 100%;
  margin: 0 auto;
}

.contacts-form__grid {
  display: grid;
  gap: 16px;
}

.calc-form__field--full {
  grid-column: 1 / -1;
}

.form-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form-errors {
  margin: 10px 0 0;
  padding-left: 18px;
}

.form-errors li + li {
  margin-top: 6px;
}

.calc-form__label {
  font-size: 0.95em;
  line-height: 1.35;
  font-weight: 600;
  color: var(--text);
}

.calc-form__control {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--bg);
  color: var(--text);
  font-size: 1em;
  line-height: 1.2;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.calc-form__control:hover {
  border-color: rgba(181, 29, 45, 0.45);
}

.calc-form__control:focus-visible {
  outline: none;
  border-color: var(--home-title);
  box-shadow: 0 0 0 3px rgba(181, 29, 45, 0.16);
}

.calc-form__control::placeholder {
  color: var(--muted);
  opacity: 1;
}

.calc-form__control--textarea {
  min-height: 160px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

.calc-form__hint {
  margin: -2px 0 0;
  font-size: 0.875em;
  line-height: 1.45;
  color: var(--muted);
}

.calc-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.calc-form__submit,
.calc-form__reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 0.625rem;
  border: 1px solid transparent;
  font-size: 0.98em;
  line-height: 1;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.calc-form__submit {
  background: var(--home-title);
  color: #ffffff;
  border-color: var(--home-title);
}

.calc-form__submit:hover {
  transform: translateY(-1px);
}

.calc-form__submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(181, 29, 45, 0.18);
}

.calc-form__reset {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.calc-form__reset:hover {
  border-color: var(--home-title);
  color: var(--text);
}

.calc-result {
  margin-top: 18px;
}

.calc-result:empty {
  display: none;
}

.calc-result__box {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: rgba(181, 29, 45, 0.05);
}

html[data-theme="dark"] .calc-result__box {
  background: rgba(181, 29, 45, 0.10);
}

.calc-result__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.calc-result__label {
  color: var(--muted);
  line-height: 1.45;
}

.calc-result__value {
  color: var(--text);
  line-height: 1.45;
  font-weight: 700;
  text-align: right;
}

.calc-result__error {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(181, 29, 45, 0.28);
  border-radius: 0.625rem;
  background: rgba(181, 29, 45, 0.08);
  color: var(--text);
  line-height: 1.5;
}

.calc-result__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9em;
  line-height: 1.5;
}

@media (min-width: 768px) {
  .calc-form__grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575px) {
  .calc-card {
    padding: 18px 16px;
  }

  .calc-card__title {
    font-size: 1.25em;
  }

  .calc-result__row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .calc-result__value {
    text-align: left;
  }
}

html[data-contrast="high"] .calc-card,
html[data-contrast="high"] .calc-form__control,
html[data-contrast="high"] .calc-result__box,
html[data-contrast="high"] .calc-result__error {
  box-shadow: none !important;
}

html[data-contrast="high"] .calc-form__submit {
  background: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

html[data-contrast="high"] .calc-form__reset,
html[data-contrast="high"] .calc-form__control {
  background: #ffffff !important;
  border-color: #000000 !important;
  color: #000000 !important;
}

html[data-contrast="high"] .calc-result__box,
html[data-contrast="high"] .calc-result__error {
  background: #ffffff !important;
  border-color: #000000 !important;
  color: #000000 !important;
}

/* ========== Constructors ========== */

.constructor-card {
  margin: 24px 0;
}

.constructor-lead {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.constructor-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.constructor-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.constructor-grid {
  display: grid;
  gap: 16px;
}

.constructor-grid--2 {
  grid-template-columns: 1fr;
}

.constructor-grid--3 {
  grid-template-columns: 1fr;
}

.constructor-hidden {
  display: none !important;
}

.constructor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.constructor-actions__note {
  color: var(--muted);
  font-size: 0.92em;
  line-height: 1.5;
}

.constructor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.constructor-toolbar__btn {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.constructor-toolbar__btn:hover {
  border-color: var(--home-title);
}

.constructor-preview {
  min-height: 380px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg);
  color: var(--text);
  overflow: auto;
  line-height: 1.6;
}

.constructor-preview:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(181, 29, 45, 0.16);
  border-color: var(--home-title);
}

.constructor-preview h2,
.constructor-preview h3 {
  margin: 0 0 12px;
}

.constructor-preview p {
  margin: 0 0 12px;
}

.constructor-preview ul,
.constructor-preview ol {
  margin: 0 0 12px 1.35rem;
  padding: 0;
}

.constructor-log {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92em;
  line-height: 1.5;
}

html[data-theme="light"] .calc-form__control[type="date"] {
  color-scheme: light;
}

.calc-form__control[type="date"]::-webkit-calendar-picker-indicator {
  padding: 6px;
  border-radius: 0.5rem;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.08);
  transition: background-color 0.18s ease, filter 0.18s ease;
}

.calc-form__control[type="date"]:hover::-webkit-calendar-picker-indicator {
  background-color: rgba(181, 29, 45, 0.14);
}

html[data-theme="dark"] .calc-form__control[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.15);
}

html[data-theme="light"] .calc-form__control[type="date"]::-webkit-calendar-picker-indicator {
  background-color: rgba(0, 0, 0, 0.06);
  filter: none;
}

@media (min-width: 768px) {
  .constructor-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .constructor-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
