/* Содержимое статьи: типографика, изображения, карусель, просмотр на весь
   экран (`specs/web/articles.md`). Подключается и на странице статьи, и в
   предпросмотре редактора админ-панели. */

.post-body { min-width: 0; color: var(--ink); font-size: 18.5px; line-height: 1.75; overflow-wrap: break-word; }
.post-body > :first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.35em; }
.post-body h2, .post-body h3, .post-body h4 { position: relative; scroll-margin-top: 88px; font-family: var(--font-display); line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
.post-body h2 { margin: 2.1em 0 0.7em; font-size: 31px; font-weight: 700; }
.post-body h3 { margin: 1.8em 0 0.6em; font-size: 23px; font-weight: 650; }
.post-body h4 { margin: 1.6em 0 0.5em; font-size: 19px; font-weight: 650; }
.post-body .anchor { position: absolute; left: -1.1em; color: var(--accent); font-weight: 400; opacity: 0; text-decoration: none; transition: opacity 0.15s; }
.post-body h2:hover .anchor, .post-body h3:hover .anchor, .post-body .anchor:focus { opacity: 0.8; }
.post-body a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: text-decoration-color 0.15s; }
.post-body a:hover { text-decoration-color: currentColor; }
.post-body .anchor, .post-body h2 a, .post-body h3 a { text-decoration: none; }
.post-body ul, .post-body ol { margin: 0 0 1.4em; padding-left: 1.35em; }
.post-body li { margin: 0.4em 0; padding-left: 0.2em; }
.post-body li::marker { color: var(--accent); font-weight: 600; }
.post-body li > p { margin: 0.3em 0; }
.post-body input[type="checkbox"] { margin-right: 8px; accent-color: var(--accent); }
.post-body strong { font-weight: 650; }
.post-body hr { height: 1px; margin: 2.6em auto; border: 0; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.post-body blockquote {
  margin: 1.8em 0; padding: 20px 24px 20px 28px; border-left: 4px solid var(--accent); border-radius: 0 16px 16px 0;
  background: var(--accent-soft); color: var(--ink); font-size: 1.02em;
}
.post-body blockquote > :last-child { margin-bottom: 0; }
.post-body code { padding: 2px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); font-family: var(--mono); font-size: 0.86em; }
.post-body pre {
  margin: 1.8em 0; padding: 20px 22px; overflow-x: auto; border-radius: 16px; background: var(--dark-box); color: #e7e6df;
  font-size: 14.5px; line-height: 1.65; box-shadow: var(--shadow-sm); tab-size: 4;
}
.post-body pre code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; }
.post-body table { display: block; width: 100%; max-width: 100%; margin: 1.8em 0; overflow-x: auto; border-collapse: collapse; font-size: 16px; line-height: 1.5; }
.post-body th, .post-body td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.post-body th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
.post-body img { max-width: 100%; height: auto; border-radius: 14px; }
.post-body .footnote-definition { margin: 0.6em 0; color: var(--muted); font-size: 15px; }

.post-body figure.photo, .post-body .gallery { margin: 2em 0; }
.post-body figure.photo img { display: block; width: 100%; border-radius: 18px; box-shadow: var(--shadow-app); cursor: zoom-in; }
.post-body figcaption { margin-top: 12px; color: var(--faint); font-size: 14px; line-height: 1.45; text-align: center; }

/* Карусель: работает и без скрипта (прокрутка со снапом), скрипт добавляет
   стрелки, точки, счётчик и клавиатуру. */
.gallery { position: relative; }
.gallery-track {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; overscroll-behavior-x: contain;
  scrollbar-width: none; border-radius: 20px; outline-offset: 4px;
}
.gallery-track::-webkit-scrollbar { display: none; }
.post-body .gallery-slide {
  position: relative; margin: 0; display: grid; flex: 0 0 100%; place-items: center; aspect-ratio: 16 / 10; overflow: hidden; scroll-snap-align: center;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2);
}
.gallery-slide img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; cursor: zoom-in; }
.gallery-slide figcaption { position: absolute; inset: auto 0 0 0; margin: 0; padding: 28px 18px 14px; background: linear-gradient(transparent, rgba(0,0,0,0.62)); color: #fff; }
.gallery-nav {
  position: absolute; z-index: 2; top: calc(50% - 22px); display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%; background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; backdrop-filter: blur(8px); box-shadow: var(--shadow-app);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.gallery-nav:hover { transform: scale(1.08); }
.gallery-nav[disabled] { opacity: 0; pointer-events: none; }
.gallery-nav--prev { left: 14px; }
.gallery-nav--next { right: 14px; }
.gallery-meta { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.gallery-dots { display: flex; gap: 7px; }
.gallery-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: var(--line-strong); cursor: pointer; transition: width 0.25s ease, background 0.25s ease; }
.gallery-dots button[aria-current="true"] { width: 24px; background: var(--accent); }
.gallery-count { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Просмотр изображения на весь экран */
.lightbox { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(8, 8, 10, 0.92); animation: lb-in 0.2s ease; cursor: zoom-out; }
.lightbox img { max-width: min(1400px, 100%); max-height: 100%; border-radius: 10px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.lightbox button { position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border: 1px solid rgba(255,255,255,0.2); border-radius: 50%; background: rgba(255,255,255,0.08); color: #fff; font-size: 22px; cursor: pointer; }
@keyframes lb-in { from { opacity: 0; } }
