/* Журнал Товарки 360, шаблон статьи v2 (задачи #396, #404). Подключается последним и правит только страницы
   с body[data-journal]. Цвета и шрифты из страницы: --ink, --orange, --acid, --muted, --line, --display, --body. */

/* Один H1: заголовки скрытых блоков главной и ленты стали <p class="h1-off">, на этих страницах они не видны. */
body[data-journal] .h1-off{margin:0 0 20px;font:800 clamp(32px,4vw,48px)/1.05 var(--display),sans-serif;letter-spacing:-.045em}

/* Обложки WebP 1280x720 */
body[data-journal] .cover.jr-raster{aspect-ratio:16/9;object-fit:cover;height:auto;background:var(--ink)}

/* Оглавление справа (вместо плашки «Где застрял ваш товар?») */
body[data-journal] .right .jr-toc{padding:18px 0 14px;margin-bottom:22px;background:none;border-top:2px solid var(--ink)}
body[data-journal] .jr-toc .eyebrow{color:var(--ink);margin-bottom:10px}
body[data-journal] .jr-toc ol{list-style:none;margin:0;padding:0;counter-reset:jrtoc}
body[data-journal] .jr-toc li{counter-increment:jrtoc}
body[data-journal] .jr-toc a{display:grid;grid-template-columns:26px 1fr;gap:6px;padding:8px 6px 8px 10px;border-left:2px solid var(--line);font-size:14px;line-height:1.35;color:var(--muted);transition:color .2s,border-color .2s,background-color .2s}
body[data-journal] .jr-toc a:before{content:counter(jrtoc,decimal-leading-zero);font-size:11px;line-height:19px;color:#b7401e;font-variant-numeric:tabular-nums}
body[data-journal] .jr-toc a:hover{color:var(--ink);background:#fff5ed}
body[data-journal] .jr-toc a[aria-current=true]{color:var(--ink);border-left-color:var(--orange);font-weight:600}
/* У статей с блоками своё оглавление внутри колонки: справа уже есть общее */
body[data-journal] .ab-article .ab-toc{display:none!important}
body[data-journal] .ab-article .ab-layout{display:block}

/* Конец статьи: главная кнопка в Telegram, запасной путь формой, карточка автора */
body[data-journal] .article .endbox{margin-top:44px;padding:26px 26px 24px;border:0;border-radius:20px;background:#fff1e8}
body[data-journal] .article .endbox h3{margin:0 0 10px;font-size:24px}
body[data-journal] .article .endbox p{margin:0 0 18px;font-size:17px;line-height:1.6;max-width:560px}
body[data-journal] .jr-actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px 22px}
body[data-journal] .article a.jr-tg{display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:0 26px;color:#fff;font-size:19px;font-weight:700;text-decoration:none}
body[data-journal] .article a.jr-tg:hover{color:#fff}
body[data-journal] .jr-alt{min-height:44px;padding:0;border:0;background:none;color:#b7401e;font-size:16px;font-weight:500;text-decoration:underline;text-underline-offset:3px}
body[data-journal] .jr-alt:hover{color:var(--ink)}
/* «Что делать дальше» (#607): оранжевая кнопка с графитовым жирным текстом от 19 px (брендбук Товарки) */
body[data-journal] .article a.jr-next{display:inline-flex;align-items:center;justify-content:center;min-height:52px;padding:0 26px;background:#F2653D;color:#2E3546;font-size:19px;font-weight:700;text-decoration:none}
body[data-journal] .article a.jr-next:hover,body[data-journal] .article a.jr-next:focus-visible{color:#2E3546;background:#f47a57}
body[data-journal] .article a.jr-next:focus-visible,body[data-journal] .jr-alt:focus-visible{outline:3px solid #2E3546;outline-offset:3px}
body[data-journal] a.jr-alt{display:inline-flex;align-items:center}
body[data-journal] .jr-author .ab-author{margin-top:22px}
body[data-journal] .jr-author .ab-name{text-decoration:none}
body[data-journal] .right .jr-crimpal a{color:#b7401e;font-weight:600;text-decoration:underline;text-underline-offset:3px}

/* FAQ-аккордеон: details в «С чем к нам обращаются» и в тексте статей */
body[data-journal] .questions details>summary,body[data-journal] .article details>summary{position:relative;list-style:none;padding-right:44px;cursor:pointer}
body[data-journal] .questions details>summary::-webkit-details-marker,body[data-journal] .article details>summary::-webkit-details-marker{display:none}
body[data-journal] .questions details>summary:after,body[data-journal] .article details:not(.ab-faq details)>summary:after{content:'';position:absolute;right:2px;top:50%;width:28px;height:28px;margin-top:-14px;border-radius:50%;background:linear-gradient(#b7401e,#b7401e) center/12px 2px no-repeat,linear-gradient(#b7401e,#b7401e) center/2px 12px no-repeat,#fff1e8;transition:transform .2s ease-out}
body[data-journal] .questions details[open]>summary:after,body[data-journal] .article details[open]:not(.ab-faq details)>summary:after{transform:rotate(45deg)}
body[data-journal] .questions summary:focus-visible,body[data-journal] .article summary:focus-visible{outline:3px solid var(--orange);outline-offset:3px;border-radius:6px}

/* Однократное появление карточек (класс ставит journal-v2.js только тем, что ниже первого экрана) */
body[data-journal] .post.jr-wait{opacity:0;transform:translateY(8px)}
body[data-journal] .post.jr-in{opacity:1;transform:none;transition:opacity .45s ease-out,transform .45s ease-out,background-color .18s}

/* Телефон и планшет до 768: рубрики одной строкой чипов; в статье строка под текстом, заголовок на первом экране */
@media (max-width:768px){
  body[data-journal] .journal{display:flex;flex-direction:column;padding:0 16px;margin-top:14px}
  body[data-journal] .journal>*{min-width:0}
  body[data-journal] .side:not(.right){position:static;display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scrollbar-width:none;margin:0 -16px 16px;padding:2px 16px 6px;background:none;border:0;border-radius:0}
  body[data-journal] .side:not(.right)::-webkit-scrollbar{display:none}
  body[data-journal] .side:not(.right) button{flex:0 0 auto;width:auto;min-height:44px;gap:8px;padding:5px 14px 5px 6px;border:1px solid var(--line);border-radius:999px;background:#fff;font-size:14px;font-weight:500;white-space:nowrap;scroll-snap-align:start}
  body[data-journal] .side:not(.right) button:before,body[data-journal] .side:not(.right) button:after{display:none}
  body[data-journal] .side:not(.right) button i{width:32px;height:32px;flex:0 0 32px;border-radius:50%}
  body[data-journal] .side:not(.right) button i:after{border-radius:50%}
  body[data-journal] .side:not(.right) button .t-icon{width:18px;height:18px}
  body[data-journal] .side:not(.right) button.active{background:var(--ink);border-color:var(--ink);color:#fff}
  body[data-page=article] .side:not(.right){order:3;margin-top:4px}
  body[data-page=article] .article{order:1;padding:20px 18px 26px;border-radius:16px}
  body[data-page=article] .article .back{display:inline-block;padding:0 0 12px}
  body[data-page=article] .article .eyebrow{margin-bottom:10px}
  body[data-journal] .article .endbox{padding:20px 18px}
  body[data-journal] .jr-actions{flex-direction:column;align-items:stretch}
  body[data-journal] .article a.jr-tg,body[data-journal] .article a.jr-next{width:100%;padding:0 16px;font-size:19px;text-align:center}
}

@media (prefers-reduced-motion:reduce){
  body[data-journal] .post.jr-wait{opacity:1;transform:none}
  body[data-journal] .post.jr-in,body[data-journal] .jr-toc a,body[data-journal] summary:after{transition:none}
}
