/* Публичная статья bitandpix.ru/<slug>/
 *
 * Токены и шрифты взяты у лендинга Медиацеха: Nata Sans для текста, CA Saygon
 * для акцентных заголовков. Файлы шрифтов уже лежат на обоих хостах в
 * /mediaceh-assets/fonts/ (site/public и frontend/public сверяются побайтово),
 * поэтому новый CDN и внешние шрифты не нужны.
 *
 * Шапка и футер остаются фирменными тёмными. Тело статьи по умолчанию
 * светлое; переключатель меняет только тело и типографику статьи и хранится
 * отдельно от темы кабинета (localStorage bitandpix_article_theme).
 */

@font-face { font-family: "Nata Sans"; font-weight: 300; font-display: swap; src: url("/mediaceh-assets/fonts/natasans-light.woff2") format("woff2"); }
@font-face { font-family: "Nata Sans"; font-weight: 400; font-display: swap; src: url("/mediaceh-assets/fonts/natasans-regular.woff2") format("woff2"); }
@font-face { font-family: "Nata Sans"; font-weight: 500; font-display: swap; src: url("/mediaceh-assets/fonts/natasans-medium.woff2") format("woff2"); }
@font-face { font-family: "Nata Sans"; font-weight: 600; font-display: swap; src: url("/mediaceh-assets/fonts/natasans-semibold.woff2") format("woff2"); }
@font-face { font-family: "Nata Sans"; font-weight: 700; font-display: swap; src: url("/mediaceh-assets/fonts/natasans-bold.woff2") format("woff2"); }
@font-face { font-family: "CA Saygon"; font-weight: 300; font-display: swap; src: url("/mediaceh-assets/fonts/casaygon-light.woff2") format("woff2"); }
@font-face { font-family: "CA Saygon"; font-weight: 400; font-display: swap; src: url("/mediaceh-assets/fonts/casaygon-regular.woff2") format("woff2"); }

:root {
  --art-red: #ff1818;
  --art-red-deep: #db1414;
  --art-ink: #171717;
  --art-ink-soft: #3d3d3d;
  --art-ink-muted: #6a6a6a;
  --art-black: #000000;
  --art-dark-grey: #202020;
  --art-page: #fbfaf8;
  --art-card: #ffffff;
  --art-stroke: rgba(23, 23, 23, 0.12);
  --art-stroke-strong: rgba(23, 23, 23, 0.22);
  --art-code-bg: #f1f0ec;
  --art-quote-bg: #f4f2ee;
  --art-sans: "Nata Sans", Arial, sans-serif;
  --art-display: "CA Saygon", "Nata Sans", Arial, sans-serif;
  --art-tracking: -0.03em;
  --art-gutter: 24px;
  --art-header-bg: #171717;
  --art-footer-bg: #000000;
}

:root[data-article-theme="dark"] {
  --art-ink: #f4f4f2;
  --art-ink-soft: #d6d6d2;
  --art-ink-muted: #a0a0a0;
  --art-page: #171717;
  --art-card: #202020;
  --art-stroke: rgba(255, 255, 255, 0.14);
  --art-stroke-strong: rgba(255, 255, 255, 0.28);
  --art-code-bg: #2a2a2a;
  --art-quote-bg: #202020;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.art {
  margin: 0;
  background: var(--art-header-bg);
  color: var(--art-ink);
  font-family: var(--art-sans);
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: var(--art-tracking);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Ссылки красные только в теле статьи и на страницах сообщений. Шапка и
 * футер держат собственные цвета: иначе общее правило перекрашивало текст
 * кнопки в красный на красном фоне. */
.art-main a:not(.art-button), .art-content a:not(.art-button) { color: var(--art-red-deep); text-underline-offset: 3px; }
.art-main a:not(.art-button):hover, .art-content a:not(.art-button):hover { color: var(--art-red); }
.art a:focus-visible,
.art button:focus-visible { outline: 2px solid var(--art-red); outline-offset: 3px; }

.art-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--art-red);
  color: #ffffff;
  padding: 12px 18px;
  z-index: 10;
}
.art-skip:focus { left: 12px; top: 12px; }

/* Шапка: 110px на широком экране, 56px на мобильном - как у лендинга. */
.art-header { background: var(--art-header-bg); color: #ffffff; }
.art-header__inner {
  width: min(1600px, 100%);
  margin: 0 auto;
  min-height: 110px;
  padding: 25px 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.art-header__home { display: block; flex: none; width: 218px; height: 60px; }
.art-header__home img { display: block; width: 100%; height: 100%; }
.art-header__nav { display: flex; gap: 20px; margin-left: clamp(20px, 8vw, 325px); }
.art-header__nav a { color: #ffffff; text-decoration: none; font-size: 16px; line-height: 1.2; white-space: nowrap; }
.art-header__nav a:hover { color: #ffffff; opacity: 0.8; }
.art-header__actions { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.art-header__login { color: #ffffff; text-decoration: none; font-size: 16px; white-space: nowrap; }
.art-header__login:hover { color: #ffffff; opacity: 0.8; }

.art-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 100px;
  background: var(--art-red);
  color: #ffffff;
  font-family: var(--art-sans);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
.art-button:hover { background: #e01010; color: #ffffff; }
.art-header .art-button { min-height: 44px; color: #ffffff; }

/* Тело статьи. */
.art-main {
  background: var(--art-page);
  color: var(--art-ink);
  padding: 56px var(--art-gutter) 96px;
}
.art-article {
  width: min(760px, 100%);
  margin: 0 auto;
  background: var(--art-card);
  border: 1px solid var(--art-stroke);
  border-radius: 24px;
  padding: 48px 56px 56px;
}
.art-article--message { text-align: left; }

.art-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.art-date { color: var(--art-ink-muted); font-size: 15px; }
.art-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.art-theme:hover { border-color: #ffffff; background: rgba(255, 255, 255, 0.08); }
.art-theme__icon { display: block; width: 20px; height: 20px; }
.art-theme__icon--sun { display: none; }
:root[data-article-theme="dark"] .art-theme__icon--moon { display: none; }
:root[data-article-theme="dark"] .art-theme__icon--sun { display: block; }
.art-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.art-title {
  margin: 0 0 20px;
  font-family: var(--art-sans);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: var(--art-tracking);
  color: var(--art-ink);
}

.art-lead {
  margin: 0 0 36px;
  font-size: 20px;
  line-height: 1.45;
  color: var(--art-ink-soft);
}

.art-code {
  margin: 0 0 12px;
  font-family: var(--art-display);
  font-size: 64px;
  line-height: 1;
  color: var(--art-red);
}

.art-content { font-size: 18px; line-height: 1.65; color: var(--art-ink-soft); }
.art-content > :first-child { margin-top: 0; }
.art-content > :last-child { margin-bottom: 0; }
.art-content p { margin: 0 0 22px; }
.art-content h2 {
  margin: 48px 0 18px;
  font-family: var(--art-sans);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: var(--art-tracking);
  text-transform: uppercase;
  color: var(--art-ink);
}
.art-content h3 {
  margin: 38px 0 14px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--art-ink);
}
.art-content h4, .art-content h5, .art-content h6 {
  margin: 30px 0 12px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--art-ink);
}
.art-content ul, .art-content ol { margin: 0 0 22px; padding-left: 1.3em; }
.art-content li { margin: 0 0 10px; }
.art-content li::marker { color: var(--art-red); }
.art-content blockquote {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 4px solid var(--art-red);
  background: var(--art-quote-bg);
  border-radius: 0 14px 14px 0;
  color: var(--art-ink);
}
.art-content blockquote > :last-child { margin-bottom: 0; }
.art-content a { color: var(--art-red-deep); }
.art-content strong { font-weight: 600; color: var(--art-ink); }
.art-content hr { margin: 40px 0; border: 0; border-top: 1px solid var(--art-stroke-strong); }
.art-content img { display: block; max-width: 100%; height: auto; margin: 28px 0; border-radius: 18px; }
.art-content figure { margin: 28px 0; }
.art-content figure img { margin: 0; }
.art-content figcaption { margin-top: 10px; font-size: 14px; color: var(--art-ink-muted); }
.art-content code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--art-code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--art-ink);
}
.art-content pre {
  margin: 0 0 24px;
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: 14px;
  background: var(--art-code-bg);
  border: 1px solid var(--art-stroke);
}
.art-content pre code { padding: 0; background: none; font-size: 15px; }
.art-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 24px;
  font-size: 16px;
}
.art-content th, .art-content td { padding: 10px 14px; border: 1px solid var(--art-stroke); text-align: left; }
.art-content th { background: var(--art-quote-bg); font-weight: 600; color: var(--art-ink); }

/* Футер: тёмный, четыре колонки на широком экране. */
.art-footer { background: var(--art-footer-bg); color: #ffffff; }
.art-footer__inner {
  position: relative;
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 56px 64px 40px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 32px;
  overflow: hidden;
}
.art-footer__sign {
  position: absolute;
  left: 64px;
  bottom: -120px;
  width: 800px;
  height: auto;
  opacity: 0.35;
  pointer-events: none;
}
.art-footer__col { position: relative; }
.art-footer__home { display: block; width: 120px; margin-bottom: 18px; }
.art-footer__home img { display: block; width: 100%; height: auto; }
.art-footer h2 {
  margin: 0 0 10px;
  font-family: var(--art-sans);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  color: #ffffff;
}
.art-footer__about { margin-top: 24px !important; width: 240px; }
.art-footer ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.art-footer p { margin: 0; }
.art-footer a { color: #ffffff; text-decoration: none; font-size: 16px; line-height: 1.3; }
.art-footer a:hover { color: #ffffff; opacity: 0.8; }
.art-footer__muted, .art-footer__note { color: rgba(255, 255, 255, 0.5); font-size: 15px; line-height: 1.3; }
.art-footer__col--brand .art-footer__muted { max-width: 300px; }
.art-footer__tg { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; }
.art-footer__note { margin-top: 32px; }
.art-footer__col--contacts ul { margin-top: 6px; }

@media (max-width: 1279px) {
  .art-header__inner { padding: 25px 32px; }
  .art-header__nav { margin-left: 48px; }
  .art-footer__inner { padding: 48px 32px 36px; }
}

@media (max-width: 1023px) {
  .art-header__inner { min-height: 56px; padding: 10px 16px; }
  .art-header__home { width: 125px; height: 34px; }
  .art-header__nav { display: none; }
  .art-header__actions { gap: 16px; }
  .art-theme { width: 36px; height: 36px; }
  .art-theme__icon { width: 18px; height: 18px; }
  .art-header .art-button { display: none; }
  .art-main { padding: 32px 20px 64px; }
  .art-article { padding: 32px 28px 40px; border-radius: 18px; }
  .art-footer__inner { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 40px 24px 28px; }
  .art-footer__sign { display: none; }
  .art-footer__col--brand { grid-column: 1 / -1; }
  .art-footer__note { grid-column: 1 / -1; margin-top: 8px; }
}

@media (max-width: 767px) {
  body.art { font-size: 16px; }
  .art-header__home { width: 118px; height: 32px; }
  .art-main { padding: 20px 12px 48px; }
  .art-article { padding: 24px 18px 32px; border-radius: 14px; }
  .art-toolbar { flex-wrap: wrap; margin-bottom: 20px; }
  .art-title { font-size: clamp(30px, 9vw, 40px); }
  .art-lead { font-size: 17px; margin-bottom: 28px; }
  .art-content { font-size: 17px; }
  .art-content h2 { font-size: 26px; margin-top: 36px; }
  .art-content h3 { font-size: 21px; }
  .art-content pre { padding: 14px; }
  .art-footer__inner { grid-template-columns: 1fr 1fr; gap: 24px 16px; padding: 32px 16px 24px; }
  .art-footer__col--brand { grid-column: 1 / -1; }
  .art-footer__col--contacts { grid-column: 2; }
  .art-footer__col--menu { grid-column: 1; }
  .art-footer__col--legal { grid-column: 2; }
  .art-footer__about { width: auto; }
}

@media (max-width: 480px) {
  /* На узком экране две колонки футера сжимают юридический текст до 150 px.
     Одна колонка читается без пляски переносов. */
  .art-footer__inner { grid-template-columns: 1fr; }
  .art-footer__col--brand,
  .art-footer__col--menu,
  .art-footer__col--legal,
  .art-footer__col--contacts,
  .art-footer__note { grid-column: 1 / -1; }
  .art-footer__about { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .art * { transition: none !important; }
}
