/* Product Hub Блог — components.
   Mobile first (designed at 390px). Breakpoints: 640px, 900px, 1100px.
   Needs tokens/tokens.css first. Inter comes from Google Fonts (see README). */

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  transition: background-color var(--motion-base) var(--ease-standard), color var(--motion-base) var(--ease-standard);
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; }
a { color: var(--accent-deep); text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.ph-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 899.98px) { .ph-hide-phone { display: none !important; } }

.ph-container { max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding-inline: var(--gutter); }

/* ===== Logo (switches with the theme) ===== */
.ph-logo { display: inline-flex; align-items: center; min-height: var(--tap); flex-shrink: 0; }
.ph-logo img { height: 32px; width: auto; }
.ph-logo--sm img { height: 28px; }
.ph-logo__dark { display: none; }
:root[data-theme="dark"] .ph-logo__light { display: none; }
:root[data-theme="dark"] .ph-logo__dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .ph-logo__light { display: none; }
  :root:not([data-theme]) .ph-logo__dark { display: block; }
}
@media (min-width: 900px) { .ph-logo img { height: 36px; } .ph-logo--sm img { height: 28px; } }
/* In the top bar: the round mark on phones, the full logo from 640px */
.ph-logo__mark { display: none; }
@media (max-width: 639.98px) {
  .ph-topbar .ph-logo__light, .ph-topbar .ph-logo__dark { display: none !important; }
  .ph-topbar .ph-logo__mark { display: block; height: 28px; }
  .ph-topbar .ph-logo { min-width: var(--tap); margin-left: -8px; justify-content: center; }
}

/* ===== Theme toggle ===== */
.ph-theme-toggle {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), scale var(--motion-press) ease;
}
.ph-theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
.ph-theme-toggle:active { scale: 0.96; }
.ph-theme-toggle svg { width: 20px; height: 20px; }
.ph-theme-toggle--sm { width: 40px; height: 40px; }
.ph-theme-toggle--sm svg { width: 18px; height: 18px; }
.ph-theme-toggle__sun { display: none; }
:root[data-theme="dark"] .ph-theme-toggle__moon { display: none; }
:root[data-theme="dark"] .ph-theme-toggle__sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .ph-theme-toggle__moon { display: none; }
  :root:not([data-theme]) .ph-theme-toggle__sun { display: block; }
}

/* ===== Buttons ===== */
.ph-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--on-solid);
  font-size: 15px; font-weight: 500; line-height: 1; cursor: pointer;
  transition: opacity var(--motion-fast) var(--ease-standard), scale var(--motion-press) ease;
}
.ph-btn:hover { opacity: 0.88; }
.ph-btn:active { scale: 0.98; }
.ph-btn svg { width: 18px; height: 18px; }
.ph-btn--ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line-strong);
  transition: border-color var(--motion-fast) var(--ease-standard), scale var(--motion-press) ease;
}
.ph-btn--ghost:hover { opacity: 1; border-color: var(--ink-3); }
/* Barely visible: «Обсудить сотрудничество» */
.ph-btn--quiet {
  min-height: var(--tap); padding: 0 18px; gap: 8px;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line);
  transition: border-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard), scale var(--motion-press) ease;
}
.ph-btn--quiet:hover { opacity: 1; color: var(--ink); border-color: var(--line-strong); }
.ph-btn--quiet svg { width: 16px; height: 16px; color: var(--muted); }
.ph-btn--sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
.ph-btn--block { width: 100%; }
@media (min-width: 640px) { .ph-btn--block { width: auto; } }

/* Arrow that leans on hover (cards, quiet button, file rows) */
.ph-arrow { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; transition: transform var(--motion-fast) var(--ease-standard); }
a:hover > .ph-arrow, .ph-card:hover .ph-arrow, .ph-file:hover .ph-arrow { transform: translate(2px, -2px); }

/* ===== Site header (feed) ===== */
.ph-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding-top: 20px; }
@media (min-width: 900px) { .ph-header { min-height: 88px; padding-top: 0; } }

/* ===== Hero (blog intro) ===== */
.ph-hero { display: flex; flex-direction: column; gap: 10px; padding: 28px 0 32px; }
.ph-hero__title { max-width: 36ch; font-size: clamp(20px, 2vw, 26px); line-height: 1.35; font-weight: 600; letter-spacing: -0.015em; text-wrap: pretty; }
.ph-hero__row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.ph-hero__lead { max-width: 46ch; font-size: 15px; line-height: 1.5; color: var(--ink-3); }
.ph-hero .ph-btn--quiet { margin-top: 8px; }
@media (min-width: 900px) {
  .ph-hero { gap: 12px; padding: 48px 0; }
  .ph-hero__lead { font-size: 16px; line-height: 1.6; }
  .ph-hero .ph-btn--quiet { margin-top: 0; }
}

/* ===== Filter tabs ===== */
.ph-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; border-bottom: 1px solid var(--line); }
.ph-tab {
  height: 48px; padding: 0; border: 0; background: none; cursor: pointer;
  font-size: 15px; font-weight: 500; color: var(--ink-3);
  box-shadow: inset 0 -2px 0 transparent;
  transition: color var(--motion-fast) var(--ease-standard), box-shadow var(--motion-base) var(--ease-out);
}
.ph-tab:hover { color: var(--ink); }
.ph-tab[aria-pressed="true"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
@media (min-width: 900px) { .ph-tabs { gap: 0 28px; } .ph-tab { height: 52px; font-size: 16px; } }

/* ===== Sticky top bar (appears after the hero scrolls away; post pages always) ===== */
.ph-topbar { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); transition: background-color var(--motion-base) var(--ease-standard); }
.ph-topbar__inner { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.ph-topbar__title { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.3; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-topbar .ph-tabs { border-bottom: 0; align-self: stretch; gap: 0 16px; flex-wrap: nowrap; }
.ph-topbar .ph-tab { height: 56px; font-size: 14px; }
.ph-topbar__actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.ph-topbar__toc { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; }
.ph-topbar__toc svg { width: 18px; height: 18px; }
.ph-topbar--feed { transform: translateY(-100%); visibility: hidden; position: fixed; left: 0; right: 0; transition: transform var(--motion-base) var(--ease-out), visibility 0s linear var(--motion-base); }
.ph-topbar--feed.is-shown { transform: none; visibility: visible; transition: transform var(--motion-base) var(--ease-out), visibility 0s; }
.ph-topbar--feed .ph-btn--quiet, .ph-topbar--feed .ph-theme-toggle { display: none; }
@media (min-width: 900px) {
  .ph-topbar__inner { min-height: 64px; gap: 20px; }
  .ph-topbar .ph-tab { height: 64px; font-size: 15px; }
  .ph-topbar .ph-tabs { gap: 0 28px; }
  .ph-topbar--feed .ph-btn--quiet, .ph-topbar--feed .ph-theme-toggle { display: inline-flex; }
}
@media (min-width: 1100px) { .ph-topbar__toc { display: none; } }

/* Reading progress (post pages) */
.ph-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); transform-origin: left center; transform: scaleX(var(--progress, 0)); }

/* ===== Feed ===== */
.ph-feed { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 20px; }
@media (min-width: 640px) { .ph-feed { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 24px; padding-top: 32px; } }
.ph-feed__more { display: flex; justify-content: center; padding-top: 24px; }
.ph-feed__more .ph-btn { width: 100%; max-width: 320px; }
.ph-feed__empty { grid-column: 1 / -1; padding: 40px 0; text-align: center; color: var(--ink-3); font-size: 15px; }
@media (min-width: 640px) { .ph-feed__more { padding-top: 40px; } }

/* ===== Cards ===== */
.ph-card {
  display: flex; flex-direction: column; gap: 16px;
  padding: 24px 20px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color var(--motion-fast) var(--ease-standard), translate var(--motion-base) var(--ease-out), scale var(--motion-press) ease, background-color var(--motion-base) var(--ease-standard);
}
a.ph-card:hover { border-color: var(--line-strong); translate: 0 -2px; }
a.ph-card:active { scale: 0.99; }
@media (min-width: 640px) { .ph-card { padding: 28px 24px; } }
.ph-card[hidden] { display: none; }

.ph-card__head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.ph-card__context { font-size: 13px; color: var(--ink-3); }
.ph-card__title { font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.ph-card__text { font-size: 16px; line-height: 1.55; color: var(--ink-2); hyphens: auto; }
.ph-card__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ph-card__meta { font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.ph-card__cta { margin-top: auto; display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: 15px; font-weight: 600; color: var(--accent-deep); }
.ph-card__cta svg { width: 18px; height: 18px; transition: transform var(--motion-fast) var(--ease-standard); }
.ph-card:hover .ph-card__cta svg { transform: translateX(3px); }
@media (min-width: 640px) { .ph-card__title { font-size: 21px; } }

/* «Новое» */
.ph-new { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--accent-deep); }
.ph-new::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Featured card: full width, contents on the right from 900px */
.ph-card--featured { grid-column: 1 / -1; }
.ph-card--featured .ph-card__title { font-size: 22px; line-height: 1.25; letter-spacing: -0.02em; }
.ph-card__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 900px) {
  .ph-card--featured { flex-direction: row; flex-wrap: wrap; gap: 24px 48px; padding: 40px; }
  .ph-card--featured .ph-card__main { flex: 1 1 420px; }
  .ph-card--featured .ph-contents { flex: 1 1 300px; padding: 24px; }
  .ph-card--featured .ph-card__title { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.18; letter-spacing: -0.025em; }
  .ph-card--featured .ph-card__text { font-size: 17px; line-height: 1.6; max-width: 52ch; }
}

/* Tool card */
.ph-card--tool { background: var(--accent-soft); border-color: var(--accent-tint); }
.ph-card--tool .ph-card__context { color: var(--ink-2); }

/* ===== Badges ===== */
.ph-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; }
.ph-badge--guide { background: var(--accent-soft); color: var(--accent-deep); }
.ph-badge--case { border: 1px solid var(--line-strong); color: var(--ink-2); }
.ph-badge--tool { background: var(--solid); color: var(--on-solid); }

/* ===== «Внутри» (contents of a guide) ===== */
.ph-contents { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius-sm); background: var(--subtle); }
.ph-contents__label { font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.ph-contents__item { display: flex; gap: 12px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.ph-contents__num { font-weight: 600; color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.ph-contents__cta { display: none; }
@media (min-width: 900px) {
  .ph-contents { gap: 14px; }
  .ph-contents__item { font-size: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
  .ph-contents__item:last-of-type { padding-bottom: 0; border-bottom: 0; }
  .ph-contents__cta { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; font-size: 15px; font-weight: 600; color: var(--accent-deep); }
  .ph-contents__cta svg { width: 18px; height: 18px; transition: transform var(--motion-fast) var(--ease-standard); }
  .ph-card:hover .ph-contents__cta svg { transform: translateX(3px); }
}

/* ===== Case facts: Задача / Сделали / Результат ===== */
.ph-facts { border-top: 1px solid var(--line); }
.ph-facts__row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ph-facts__row:last-child { border-bottom: 0; }
.ph-facts dt { font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.ph-facts dd { font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.ph-facts__row--result dd { color: var(--ink); font-weight: 500; }

/* ===== Tool preview (decorative, aria-hidden) ===== */
.ph-tool-preview { display: flex; flex-direction: column; padding: 4px 14px; border-radius: var(--radius-sm); background: var(--surface); }
.ph-tool-preview__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line); }
.ph-tool-preview__row:last-child { border-bottom: 0; }
.ph-tool-preview__label { font-size: 13px; color: var(--ink-3); }
.ph-tool-preview__value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ===== Footer ===== */
.ph-footer { margin-top: 56px; border-top: 1px solid var(--line); }
.ph-footer__inner { display: flex; flex-direction: column; gap: 20px; padding-block: 40px 48px; }
.ph-footer__about { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.4; color: var(--ink-3); }
.ph-footer__about img { width: 20px; height: 20px; }
.ph-footer__copy { font-size: 13px; color: var(--ink-3); }
.ph-footer__contact { display: flex; flex-direction: column; gap: 16px; }
.ph-footer__ask { font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.ph-footer__group { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 900px) {
  .ph-footer { margin-top: 88px; }
  .ph-footer__inner { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px 40px; padding-block: 40px 56px; }
  .ph-footer__contact { flex-direction: row; align-items: center; gap: 24px; }
  .ph-footer__ask { font-size: 17px; }
}

/* ===== Back to top ===== */
.ph-to-top {
  position: fixed; z-index: 50; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom));
  width: 48px; height: 48px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); cursor: pointer;
  opacity: 0; translate: 0 8px; pointer-events: none;
  transition: opacity var(--motion-base) var(--ease-out), translate var(--motion-base) var(--ease-out);
}
.ph-to-top.is-visible { opacity: 1; translate: 0 0; pointer-events: auto; }
.ph-to-top svg { width: 22px; height: 22px; }
@media (min-width: 900px) { .ph-to-top { right: 40px; bottom: 40px; } }

/* ===== Post page ===== */
.ph-post { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 56px; }
.ph-post__rail { display: none; }
.ph-post__article { flex: 999 1 560px; min-width: 0; max-width: 840px; }
@media (min-width: 1100px) {
  .ph-post__rail { display: flex; flex-direction: column; gap: 28px; flex: 0 0 232px; position: sticky; top: 96px; padding: 40px 0 24px; }
}

.ph-crumb { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-size: 14px; font-weight: 500; color: var(--ink-2); transition: color var(--motion-fast) var(--ease-standard); }
.ph-crumb:hover { color: var(--ink); }
.ph-crumb svg { width: 16px; height: 16px; transition: transform var(--motion-fast) var(--ease-standard); }
.ph-crumb:hover svg { transform: translateX(-2px); }
.ph-post__article > .ph-crumb { margin-top: 12px; }
@media (min-width: 1100px) { .ph-post__article > .ph-crumb { display: none; } }

.ph-cover { display: flex; flex-direction: column; align-items: flex-start; padding: 12px 0 32px; border-bottom: 1px solid var(--line); }
.ph-cover__title { margin-top: 16px; max-width: 22ch; font-size: clamp(30px, 4vw, 52px); line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
.ph-cover__lead { margin-top: 16px; max-width: var(--measure); font-size: 17px; line-height: 1.55; color: var(--ink-2); hyphens: auto; }
.ph-cover__date { margin-top: 20px; font-size: 13px; line-height: 1.4; color: var(--ink-3); }
@media (min-width: 900px) {
  .ph-cover { padding: 72px 0 40px; }
  .ph-cover__title { line-height: 1.08; }
  .ph-cover__lead { margin-top: 20px; font-size: 19px; }
  .ph-cover__date { margin-top: 24px; font-size: 14px; }
}

/* Table of contents rail */
.ph-toc__label, .ph-eyebrow { font-size: 12px; line-height: 1.4; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.ph-toc__label { margin-bottom: 12px; }
.ph-toc__link { display: grid; grid-template-columns: 28px 1fr; align-items: baseline; gap: 4px; padding: 7px 0; font-size: 14px; line-height: 1.4; color: var(--ink-3); transition: color var(--motion-fast) var(--ease-standard); }
.ph-toc__link:hover { color: var(--ink); }
.ph-toc__num { font-size: 12px; font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; transition: color var(--motion-fast) var(--ease-standard); }
.ph-toc__link[aria-current="true"] { color: var(--ink); font-weight: 600; }
.ph-toc__link[aria-current="true"] .ph-toc__num { color: var(--accent); }

/* Phone TOC sheet */
.ph-sheet { width: 100%; max-width: 480px; max-height: 80vh; margin: auto auto 0; padding: 0 0 env(safe-area-inset-bottom); border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); }
.ph-sheet::backdrop { background: rgba(11, 11, 12, 0.4); }
.ph-sheet[open] { animation: ph-sheet-up var(--motion-base) var(--ease-out); }
.ph-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 20px; }
.ph-sheet__title { font-size: 15px; font-weight: 600; }
.ph-sheet__close { width: var(--tap); height: var(--tap); padding: 0; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); cursor: pointer; border-radius: var(--radius-pill); }
.ph-sheet__close svg { width: 22px; height: 22px; }
.ph-sheet__body { padding: 0 20px 20px; overflow: auto; }
.ph-sheet .ph-toc__link { min-height: 48px; align-items: center; }
@keyframes ph-sheet-up { from { transform: translateY(24px); opacity: 0; } }

/* Summary «Коротко» */
.ph-summary { max-width: var(--measure); padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ph-summary .ph-eyebrow { margin-bottom: 14px; }
.ph-summary__list { display: grid; gap: 14px; counter-reset: sum; }
.ph-summary__list > li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; font-size: 16px; line-height: 1.55; color: var(--ink-2); counter-increment: sum; }
.ph-summary__list > li::before { content: counter(sum); width: 24px; height: 24px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); font-size: 13px; font-weight: 600; }
.ph-summary__list strong { color: var(--ink); font-weight: 600; }
@media (min-width: 900px) { .ph-summary { padding: 28px; } .ph-summary__list > li { font-size: 17px; gap: 10px; } }

/* Sections */
.ph-section { display: flex; flex-direction: column; gap: 20px; padding-top: 48px; scroll-margin-top: 72px; }
.ph-section--first { padding-top: 32px; }
.ph-section__head { margin-bottom: 8px; }
.ph-section__head .ph-eyebrow { margin-bottom: 10px; }
.ph-section__title { max-width: 26ch; font-size: clamp(26px, 3.6vw, 34px); line-height: 1.15; font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
@media (min-width: 900px) { .ph-section { padding-top: 88px; } .ph-section--first { padding-top: 48px; } }

.ph-prose { max-width: var(--measure); font-size: 16px; line-height: 1.6; color: var(--ink-2); hyphens: auto; }
.ph-prose + .ph-prose { margin-top: 0; }
.ph-prose strong { color: var(--ink); font-weight: 600; }
.ph-prose mark { background: var(--accent-soft); color: var(--ink); padding: 0 3px; border-radius: 3px; }
.ph-prose a { background-image: linear-gradient(currentColor, currentColor); background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat; box-shadow: inset 0 -1px 0 color-mix(in srgb, currentColor 35%, transparent); transition: background-size var(--motion-base) var(--ease-out); }
.ph-prose a:hover { background-size: 100% 1px; }
.ph-h3 { margin-top: 12px; font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
@media (min-width: 640px) { .ph-prose { font-size: 17px; } .ph-h3 { font-size: 21px; margin-top: 20px; } }

/* Numbered list */
.ph-olist { max-width: var(--measure); display: grid; gap: 14px; font-size: 16px; line-height: 1.55; color: var(--ink-2); counter-reset: ol; }
.ph-olist > li { display: grid; grid-template-columns: 40px minmax(0, 1fr); counter-increment: ol; }
.ph-olist > li::before { content: counter(ol, decimal-leading-zero); padding-top: 2px; font-size: 13px; font-weight: 500; letter-spacing: 0.04em; color: var(--ink-3); font-variant-numeric: tabular-nums; }
@media (min-width: 640px) { .ph-olist { font-size: 17px; line-height: 1.6; } }

/* Callout «Совет» */
.ph-callout { max-width: var(--measure); margin-top: 12px; padding: 18px 20px; border-radius: var(--radius); background: var(--accent-soft); }
.ph-callout__label { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-deep); }
.ph-callout__label svg { width: 16px; height: 16px; }
.ph-callout p { font-size: 16px; line-height: 1.55; font-weight: 500; color: var(--ink); }
@media (min-width: 640px) { .ph-callout { padding: 20px 24px; margin-top: 20px; } .ph-callout p { font-size: 17px; } }

/* Figure (screenshot): full bleed on phones */
.ph-figure { margin: 12px calc(-1 * var(--gutter)) 0; }
.ph-figure img, .ph-figure__placeholder { width: 100%; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--subtle); }
.ph-figure__placeholder { display: grid; place-items: center; min-height: 220px; font-size: 14px; color: var(--ink-2); }
@media (min-width: 640px) {
  .ph-figure { margin: 20px 0 0; }
  .ph-figure img, .ph-figure__placeholder { border: 1px solid var(--line); border-radius: var(--radius); }
  .ph-figure__placeholder { min-height: 360px; font-size: 15px; }
}

/* Files («Материалы») */
.ph-files { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ph-file { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink); transition: background-color var(--motion-fast) var(--ease-standard); }
.ph-file:last-child { border-bottom: 0; }
.ph-file:hover { background: var(--subtle); }
.ph-file__icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--subtle); color: var(--accent-deep); }
.ph-file__icon svg { width: 20px; height: 20px; }
.ph-file__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ph-file__name { font-size: 16px; line-height: 1.35; font-weight: 600; }
.ph-file__kind { font-size: 13px; color: var(--ink-3); }
@media (min-width: 900px) {
  .ph-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; background: none; border: 0; border-radius: 0; overflow: visible; }
  .ph-file { flex-direction: column; align-items: stretch; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color var(--motion-fast) var(--ease-standard), translate var(--motion-base) var(--ease-out); }
  .ph-file:last-child { border-bottom: 1px solid var(--line); }
  .ph-file:hover { background: var(--surface); border-color: var(--line-strong); translate: 0 -2px; }
  .ph-file__top { display: flex; align-items: center; justify-content: space-between; }
}
.ph-file__top { display: contents; }
@media (min-width: 900px) { .ph-file__top { display: flex; } }

/* Soft CTA card */
.ph-cta-card { display: flex; flex-direction: column; gap: 12px; margin-top: 48px; padding: 24px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ph-cta-card__title { font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.ph-cta-card__text { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.ph-cta-card .ph-btn--quiet { align-self: flex-start; margin-top: 4px; }
@media (min-width: 900px) {
  .ph-cta-card { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; margin-top: 72px; padding: 32px; }
  .ph-cta-card__body { flex: 1 1 360px; display: flex; flex-direction: column; gap: 8px; }
  .ph-cta-card__title { font-size: 21px; }
  .ph-cta-card .ph-btn--quiet { align-self: center; margin-top: 0; }
}

/* Related «Читать дальше» */
.ph-related { display: flex; flex-direction: column; gap: 16px; padding-top: 48px; }
.ph-related__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.ph-related .ph-card { gap: 12px; padding: 20px; }
.ph-related .ph-card__title { font-size: 18px; }
@media (min-width: 900px) { .ph-related { padding-top: 72px; } .ph-related .ph-card { padding: 24px; } .ph-related .ph-card__title { font-size: 19px; } }

/* ===== Motion: reveal on scroll =====
   Elements already on screen at load stay put (no flash). Driven by js/theme.js
   adding .ph-reveal / .is-in, with a CSS scroll-timeline fallback-free design:
   without the script nothing is hidden. */
.ph-reveal { opacity: 0; transform: translateY(var(--reveal-shift)); transition: opacity var(--motion-reveal) var(--ease-out), transform var(--motion-reveal) var(--ease-out); }
.ph-reveal.is-in { opacity: 1; transform: none; }
.ph-theme-toggle.is-turning svg { animation: ph-turn 350ms var(--ease-out); }
@keyframes ph-turn { from { opacity: 0; transform: rotate(-60deg) scale(0.7); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .ph-reveal { opacity: 1; transform: none; }
  a.ph-card:hover, .ph-file:hover { translate: none; }
}

/* ===== Print ===== */
@media print {
  .ph-topbar, .ph-theme-toggle, .ph-to-top, .ph-post__rail, .ph-feed__more, .ph-tabs { display: none !important; }
  .ph-reveal { opacity: 1; transform: none; }
  .ph-card, .ph-summary, .ph-callout { break-inside: avoid; }
}
