/* Блог SelfieDoc. Токены — из /assets/css/tokens.css (--ds-*), литералы — фолбэк. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--ds-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif);
  color: var(--ds-ink, #1d1d1f);
  background: var(--ds-bg-canvas, #f5f5f7);
  line-height: 1.55;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; }
a { color: var(--ds-primary, #007aff); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---- шапка ---- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(245, 245, 247, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--ds-border, #e5e5ea);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.logo img { display: block; height: 28px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 20px; font-size: 15px; }
.site-nav a:not(.btn) { color: var(--ds-ink, #1d1d1f); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px; border-radius: 999px;
  background: var(--ds-surface, #fff); color: var(--ds-ink, #1d1d1f);
  border: 1px solid var(--ds-border-strong, #d1d1d6);
  font-weight: 600; font-size: 16px; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary, .btn--small { background: var(--ds-primary, #007aff); color: #fff; border-color: transparent; }
.btn--primary:hover, .btn--small:hover { background: var(--ds-primary-hover, #0062cc); }
.btn--small { min-height: 36px; padding: 0 16px; font-size: 14px; }

/* ---- хлебные крошки ---- */
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--ds-ink-secondary, #86868b); padding: 20px 0 0; }
.crumbs a { color: var(--ds-ink-secondary, #86868b); }

/* ---- статья ---- */
.article-layout { padding-bottom: 48px; }
.article {
  max-width: 760px; margin: 16px auto 0;
  background: var(--ds-surface, #fff);
  border-radius: 24px; padding: 40px 48px 48px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.article__head h1 { font-size: 38px; line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 16px; font-weight: 750; }
.lead { font-size: 20px; line-height: 1.5; color: #3a3a3c; margin: 0 0 16px; }
.meta { font-size: 14px; color: var(--ds-ink-secondary, #86868b); margin: 0 0 24px; }
.cover { margin: 0 0 24px; }
.cover img { border-radius: 16px; display: block; }
.draft-flag { background: var(--ds-warning-soft, #fff4e5); color: #8a5300; padding: 8px 12px; border-radius: 10px; font-size: 14px; }

.toc { background: var(--ds-surface-sunken, #f2f2f5); border-radius: 16px; padding: 18px 22px; margin: 0 0 32px; }
.toc__title { font-weight: 650; margin: 0 0 8px; }
.toc ol { margin: 0; padding-inline-start: 20px; }
.toc li { margin: 4px 0; }

.prose { font-size: 18px; line-height: 1.7; }
.prose > * + * { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose figure, .prose .table-wrap { margin: 0 0 20px; }
.prose h2 { font-size: 28px; line-height: 1.25; letter-spacing: -0.02em; margin: 44px 0 16px; font-weight: 700; }
.prose h3 { font-size: 21px; line-height: 1.3; margin: 32px 0 12px; font-weight: 650; }
.prose li { margin: 6px 0; }
.prose ul, .prose ol { padding-inline-start: 24px; }
.prose blockquote {
  border-inline-start: 4px solid var(--ds-primary, #007aff);
  background: var(--ds-primary-soft, rgba(0, 122, 255, 0.08));
  padding: 14px 18px; border-radius: 0 12px 12px 0;
}
[dir="rtl"] .prose blockquote { border-radius: 12px 0 0 12px; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: var(--ds-font-mono, monospace); font-size: 0.9em; background: var(--ds-surface-sunken, #f2f2f5); padding: 2px 6px; border-radius: 6px; }
.prose img { border-radius: 12px; display: block; }
.prose figcaption { font-size: 14px; color: var(--ds-ink-secondary, #86868b); margin-top: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--ds-border, #e5e5ea); margin: 36px 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; }
.prose th, .prose td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--ds-border, #e5e5ea); vertical-align: top; }
.prose th { font-weight: 650; background: var(--ds-surface-sunken, #f2f2f5); }

/* ---- CTA ---- */
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.08), rgba(0, 122, 255, 0.03));
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 20px; padding: 22px 24px; margin: 32px 0;
}
.cta__title { font-weight: 700; font-size: 19px; margin: 0 0 6px; }
.cta__text { margin: 0; font-size: 16px; line-height: 1.5; color: #3a3a3c; }
.cta__action { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.cta__note { font-size: 13px; color: var(--ds-ink-secondary, #86868b); }
.cta--end, .cta--index { margin-top: 40px; }
.cta--index { max-width: 760px; margin-inline: auto; margin-bottom: 48px; }

/* ---- FAQ ---- */
.faq { margin-top: 44px; }
.faq h2 { font-size: 28px; letter-spacing: -0.02em; margin: 0 0 12px; }
.faq details { border-bottom: 1px solid var(--ds-border, #e5e5ea); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 650; font-size: 18px; list-style: none; position: relative; padding-inline-end: 28px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; inset-inline-end: 4px; top: 0; font-weight: 400; font-size: 22px; line-height: 1.1; color: var(--ds-ink-secondary, #86868b); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { font-size: 17px; line-height: 1.65; padding-top: 8px; }
.faq details > div p { margin: 0 0 10px; }

/* ---- карточки ---- */
.related { max-width: 760px; margin: 40px auto 0; }
.related h2 { font-size: 24px; margin: 0 0 16px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cards--index { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card a {
  display: flex; flex-direction: column; gap: 8px; height: 100%;
  background: var(--ds-surface, #fff); border-radius: 18px; padding: 20px;
  color: var(--ds-ink, #1d1d1f); border: 1px solid transparent;
  transition: border-color .15s ease, transform .15s ease;
}
.card a:hover { text-decoration: none; border-color: var(--ds-border-strong, #d1d1d6); transform: translateY(-1px); }
.card__title { font-weight: 700; font-size: 18px; line-height: 1.3; }
.card__text { font-size: 15px; line-height: 1.5; color: #3a3a3c; }
.card__meta { margin-top: auto; font-size: 13px; color: var(--ds-ink-secondary, #86868b); }

.blog-head { max-width: 760px; padding: 40px 0 24px; }
.blog-head h1 { font-size: 40px; line-height: 1.12; letter-spacing: -0.025em; margin: 0 0 12px; }

/* ---- подвал ---- */
.site-footer { border-top: 1px solid var(--ds-border, #e5e5ea); padding: 28px 0 40px; font-size: 14px; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.site-footer a { color: var(--ds-ink-secondary, #86868b); }

/* ---- мобильный ---- */
@media (max-width: 860px) {
  .cards--index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .site-nav { gap: 12px; }
  .article { padding: 24px 18px 32px; border-radius: 18px; margin-top: 12px; }
  .article__head h1 { font-size: 29px; }
  .lead { font-size: 18px; }
  .prose { font-size: 17px; }
  .prose h2 { font-size: 24px; margin-top: 36px; }
  .cta { flex-direction: column; align-items: stretch; padding: 20px; }
  .cta__action .btn { width: 100%; }
  .cards, .cards--index { grid-template-columns: minmax(0, 1fr); }
  .blog-head { padding-top: 28px; }
  .blog-head h1 { font-size: 30px; }
}

/* ---- согласие на cookie ---- */
.consent {
  position: fixed; z-index: 50; inset-inline: 16px; bottom: 16px; margin-inline: auto; max-width: 560px;
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--ds-border, #e5e5ea); border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); font-size: 14px; line-height: 1.45;
}
.consent__text { margin: 0; flex: 1 1 260px; }
.consent__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn--ghost { background: var(--ds-surface-sunken, #f2f2f5); color: var(--ds-ink, #1d1d1f); }
.btn--ghost:hover { background: var(--ds-border, #e5e5ea); }
