/* Блог (/blog/, templates/blog.html и post.html; разметка статей — tools/blog.py). Подключается только на страницах блога,
   поверх site.css (токены, стилистика по мотивам trumpf.com: прямые углы, серые панели, светлые заголовки). */

/* ---------- шапка статьи ---------- */
.post-head{max-width:900px;padding:8px 0 26px}
.post-head .eyebrow{margin:0 0 14px;color:var(--muted)}
.post-head .eyebrow a{color:var(--brand);text-decoration:none}
.post-head .eyebrow a:hover{text-decoration:underline}
.post-head h1{margin:0 0 16px;font-size:clamp(28px,3.6vw,44px);line-height:1.12}
.post-lead{margin:0 0 20px;max-width:780px;font-size:19px;line-height:1.55;color:var(--ink-2)}
.post-meta{display:flex;flex-wrap:wrap;align-items:center;gap:10px 24px;font-size:14px;color:var(--muted)}
.post-mi{display:inline-flex;align-items:center;gap:6px;color:var(--muted);text-decoration:none}
.post-mi .ic{width:17px;height:17px}
a.post-mi{color:var(--brand);font-weight:500}
a.post-mi:hover{text-decoration:underline}
.post-au{display:inline-flex;align-items:center;gap:10px}
.post-au img{width:40px;height:40px;border-radius:50%!important;object-fit:cover;background:var(--paper)}
.post-au span{display:flex;flex-direction:column;line-height:1.25}
.post-au b{color:var(--ink);font-weight:500}
.post-au small{font-size:12px;letter-spacing:.06em;text-transform:uppercase}

/* ---------- сетка: текст + липкая колонка ---------- */
.post-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:56px;align-items:start;padding-top:28px;border-top:1px solid var(--line)}
.post-main{max-width:760px;min-width:0}
.post-stick{position:sticky;top:calc(var(--hdr) + 12px);display:grid;gap:14px;max-height:calc(100vh - var(--hdr) - 24px);overflow:auto;
  overscroll-behavior:contain;scrollbar-width:thin}
.post-toc,.post-links,.post-cta{padding:18px 20px;background:var(--paper)}
.post-toc>b,.post-links>b{display:block;margin:0 0 10px;font-size:12px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--ink)}
.post-toc ol{list-style:none;margin:0;padding:0;display:grid;gap:2px;counter-reset:toc}
.post-toc li{counter-increment:toc}
.post-toc a{display:grid;grid-template-columns:22px minmax(0,1fr);padding:5px 0 5px 10px;border-left:2px solid var(--line);font-size:14px;line-height:1.35;
  color:var(--ink-2);text-decoration:none}
.post-toc a::before{content:counter(toc);font:500 12px/1.6 var(--mono);color:var(--muted)}
.post-toc a:hover{color:var(--brand);border-left-color:var(--brand)}
.post-toc a.on{color:var(--brand);border-left-color:var(--brand);font-weight:500}
.post-links ul{list-style:none;margin:0;padding:0;display:grid;gap:2px}
.post-links a{display:flex;gap:10px;align-items:flex-start;padding:7px 0;font-size:14.5px;line-height:1.35;color:var(--ink);text-decoration:none;font-weight:450}
.post-links a .ic{flex:none;width:16px;height:16px;margin-top:2px;color:var(--brand)}
.post-links a:hover{color:var(--brand)}
.post-cta{background:var(--panel)}
.post-cta b{display:block;font-size:18px;font-weight:500;line-height:1.3;margin-bottom:8px}
.post-cta p{margin:0 0 14px;font-size:14.5px;line-height:1.5;color:var(--ink-2)}

/* содержание на телефоне — сворачивается */
.post-tocm{display:none;margin:0 0 22px;background:var(--paper)}
.post-tocm summary{cursor:pointer;padding:14px 44px 14px 16px;font-size:13px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;list-style:none;position:relative}
.post-tocm summary::-webkit-details-marker{display:none}
.post-tocm summary::after{content:"+";position:absolute;right:16px;top:9px;font:400 22px var(--mono);color:var(--brand)}
.post-tocm[open] summary::after{content:"−"}
.post-tocm ol{margin:0;padding:0 16px 14px 36px;display:grid;gap:6px;font-size:15px}
.post-tocm a{color:var(--ink-2);text-decoration:none}

/* ---------- «Коротко» ---------- */
.post-key{margin:0 0 28px;padding:20px 24px 18px;background:var(--paper);border-left:3px solid var(--brand)}
.post-key h2{margin:0 0 10px;font-size:12px;font-weight:600;letter-spacing:.1em;text-transform:uppercase}
.post-key ul{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.post-key li{position:relative;padding-left:22px;font-size:16px;line-height:1.5;color:var(--ink)}
.post-key li::before{content:"";position:absolute;left:2px;top:.62em;width:8px;height:8px;background:var(--brand)}

/* ---------- ролик ---------- */
.post-video{display:grid;grid-template-columns:minmax(0,320px) minmax(0,1fr);gap:24px;align-items:center;margin:0 0 32px;padding:16px;background:var(--panel)}
.post-video-v{grid-template-columns:180px minmax(0,1fr)}
.post-video-img{position:relative;display:block;overflow:hidden;background:#0B0D10}
.post-video-img img{display:block;width:100%;height:auto;transition:transform .3s ease}
.post-video-img:hover img{transform:scale(1.03)}
.post-video-img:hover .vplay{transform:scale(1.08);background:#fff}
.post-video-v .vplay-lg{width:60px;height:60px;margin:-30px 0 0 -30px}
.post-video-b .eyebrow{margin:0 0 8px;color:var(--muted)}
.post-video-b>b{display:block;font-size:20px;font-weight:450;line-height:1.3;margin-bottom:8px}
.post-video-b>p{margin:0 0 14px;font-size:15px;line-height:1.5;color:var(--ink-2)}
.post-video-cta{display:flex;flex-wrap:wrap;align-items:center;gap:10px 20px;margin:0!important}
.post-video-cta .btn .ic{width:16px;height:16px}

/* ---------- текст статьи ---------- */
.post-body{font-size:17px;line-height:1.68;color:var(--ink)}
.post-body::after{content:"";display:table;clear:both}
.post-body>p,.post-body li{color:var(--ink)}
.post-body p{margin:0 0 1.05em}
.post-body h2{clear:both;margin:1.9em 0 .6em;font-size:clamp(23px,2.3vw,28px);line-height:1.22;font-weight:450;scroll-margin-top:calc(var(--hdr) + 16px)}
.post-body h2:first-child{margin-top:0}
.post-body h3{margin:1.5em 0 .5em;font-size:19px;line-height:1.3;font-weight:550}
.post-body h4{margin:1.3em 0 .4em;font-size:17px;font-weight:600}
.post-body ul,.post-body ol{margin:0 0 1.1em;padding-left:24px}
.post-body li{margin:0 0 .45em;padding-left:2px}
.post-body li::marker{color:var(--brand)}
.post-body ol>li::marker{font:600 15px var(--mono)}
.post-body a{color:var(--brand);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}
.post-body a:hover{text-decoration-thickness:2px}
.post-body strong{font-weight:600}
.post-body blockquote{margin:1.2em 0;padding:4px 0 4px 20px;border-left:3px solid var(--line);color:var(--ink-2)}
.post-body .tscroll{clear:both;margin:1.2em 0 1.4em}
.ptbl{width:100%;border-collapse:collapse;font-size:15px;line-height:1.45}
.ptbl th,.ptbl td{padding:10px 12px;border:1px solid var(--line);vertical-align:top;text-align:left}
.ptbl thead th{background:var(--paper);font-weight:600}
.ptbl tbody tr:nth-child(even) td{background:#FAFAFA}
.pformula{margin:.8em 0 1em!important;padding:12px 16px;background:var(--paper);font:500 16px/1.5 var(--mono);overflow-x:auto;white-space:nowrap}

/* ---------- фото в тексте ---------- */
.pfig{margin:0}
.pfig a{position:relative;display:block;cursor:zoom-in;text-decoration:none!important}
.pfig img{display:block;max-width:100%;height:auto;background:var(--paper)}
.pfig a::after{content:"";position:absolute;right:8px;bottom:8px;width:34px;height:34px;opacity:0;transition:opacity .2s;
  background:rgba(255,255,255,.94) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23003DA5' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.8'/%3E%3Cpath d='m15.6 15.6 4.9 4.9M10.5 7.6v5.8M7.6 10.5h5.8'/%3E%3C/svg%3E") center/20px no-repeat;
  box-shadow:0 2px 8px rgba(0,0,0,.18)}
.pfig a:hover::after,.pfig a:focus-visible::after{opacity:1}
@media (hover:none){.pfig a::after{opacity:.92}}
.pfig figcaption{margin-top:8px;font-size:13.5px;line-height:1.45;color:var(--muted)}
.pfig-side{float:right;clear:right;width:300px;margin:6px 0 18px 32px}
.pfig-wide{clear:both;margin:1.4em 0 1.6em}
.pfig-wide a{display:flex;justify-content:center;padding:16px;background:var(--paper)}
.pfig-wide img{background:none}
.pfig-svg a{padding:0;background:none}
.pfig-svg svg{display:block;width:100%;height:auto;max-width:720px}

/* ---------- плитки «Фото» ---------- */
.post-gal{margin:40px 0 0;clear:both}
.post-gal h2,.post-faq h2{margin:0 0 14px;font-size:clamp(23px,2.3vw,28px);font-weight:450;scroll-margin-top:calc(var(--hdr) + 16px)}
.post-gal ul{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:6px}
.post-gal a{position:relative;display:block;aspect-ratio:1;overflow:hidden;background:var(--paper);cursor:zoom-in}
.post-gal img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .3s ease}
.post-gal a:hover img{transform:scale(1.05)}
.post-gal-n{margin:10px 0 0;font-size:13px;color:var(--muted)}

/* ---------- вопросы, автор ---------- */
.post-faq{margin:44px 0 0;clear:both}
.post-faq .faq summary{font-weight:500;font-size:16.5px}
.post-faq .faq-a{font-size:16px;line-height:1.6}
.post-by{display:flex;align-items:center;gap:16px;margin:40px 0 0;padding:20px 0 0;border-top:1px solid var(--line)}
.post-by img{flex:none;width:56px;height:56px;border-radius:50%!important;object-fit:cover;background:var(--paper)}
.post-by p{margin:0;display:flex;flex-direction:column;line-height:1.35}
.post-by small{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.post-by b{font-size:17px;font-weight:500}
.post-by span{font-size:14px;color:var(--muted)}

/* ---------- список статей /blog/ и «Читайте также» ---------- */
.bloghead{max-width:900px}
.btopics{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 24px}
.btopic{min-height:40px;padding:0 16px;border:1px solid var(--line);background:#fff;color:var(--ink);font-size:12.5px;font-weight:600;letter-spacing:.06em;
  text-transform:uppercase;cursor:pointer;transition:background .15s,border-color .15s,color .15s}
.btopic:hover{border-color:var(--ink)}
.btopic[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:#fff}
.bcards{list-style:none;margin:0 0 20px;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px 20px}
.bcard a{display:flex;flex-direction:column;height:100%;color:var(--ink);text-decoration:none;background:var(--paper);transition:background .15s}
.bcard a:hover{background:var(--panel)}
.bcard-img{position:relative;display:block;aspect-ratio:3/2;overflow:hidden;background:var(--panel)}
.bcard-img img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;transition:transform .35s ease}
.bcard a:hover .bcard-img img{transform:scale(1.04)}
.bcard-v{position:absolute;left:10px;bottom:10px;display:inline-flex;align-items:center;gap:4px;padding:4px 8px 4px 6px;background:rgba(10,12,16,.8);
  color:#fff;font:500 12px/1.2 var(--mono);font-style:normal}
.bcard-v .ic{width:14px;height:14px}
.bcard-b{display:flex;flex-direction:column;gap:8px;padding:18px 20px 22px;flex:1}
.bcard-t{font-size:11.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--brand)}
.bcard b{font-size:19px;font-weight:450;line-height:1.3}
.bcard-l{font-size:14.5px;line-height:1.5;color:var(--ink-2);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.bcard-m{margin-top:auto;padding-top:4px;font-size:13px;color:var(--muted)}
.bcard-big{grid-column:1/-1}
.bcard-big a{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr)}
.bcard-big .bcard-img{aspect-ratio:auto;min-height:340px}
.bcard-big .bcard-b{justify-content:center;gap:12px;padding:32px 36px}
.bcard-big b{font-size:clamp(24px,2.4vw,32px);font-weight:400;line-height:1.2}
.bcard-big .bcard-l{font-size:16.5px;-webkit-line-clamp:4}
.bcard-big .bcard-m{margin-top:4px}
.bcard-big .more{margin-top:6px}
.bcards [hidden]{display:none!important}

/* ---------- адаптив ---------- */
@media (max-width:1100px){
  .post-grid{grid-template-columns:minmax(0,1fr) 260px;gap:36px}
}
@media (max-width:1000px){
  .post-grid{grid-template-columns:minmax(0,1fr);gap:0}
  .post-main{max-width:none}
  .post-side{margin-top:36px}
  .post-stick{position:static;max-height:none;overflow:visible;grid-template-columns:repeat(2,minmax(0,1fr))}
  .post-toc{display:none}
  .post-tocm{display:block}
  .bcards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .bcard-big a{grid-template-columns:minmax(0,1fr)}
  .bcard-big .bcard-img{aspect-ratio:16/9;min-height:0}
  .bcard-big .bcard-b{padding:22px 22px 26px}
}
@media (max-width:700px){
  .post-head{padding-bottom:20px}
  .post-lead{font-size:17px}
  .post-meta{gap:8px 16px;font-size:13.5px}
  .post-grid{padding-top:20px}
  .post-body{font-size:16.5px;line-height:1.64}
  .pfig-side{float:none;width:auto;margin:1.2em 0 1.4em}
  .pfig-side img{width:100%;aspect-ratio:4/3;object-fit:cover}
  .pfig-wide a{padding:10px}
  .post-video,.post-video-v{grid-template-columns:minmax(0,1fr);gap:14px;padding:12px}
  .post-video-v{grid-template-columns:120px minmax(0,1fr);align-items:start}
  .post-video-v .vplay-lg{width:44px;height:44px;margin:-22px 0 0 -22px}
  .post-video-v .vplay-lg .ic{width:20px;height:20px}
  .post-video-b>b{font-size:17px}
  .post-video-b>p{display:none}
  .post-key{padding:16px 18px 14px}
  .post-key li{font-size:15.5px}
  .post-stick{grid-template-columns:minmax(0,1fr)}
  .post-gal ul{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
  .bcards{grid-template-columns:minmax(0,1fr);gap:16px}
  .bcard-img{aspect-ratio:16/9}
  .btopics{flex-wrap:nowrap;overflow-x:auto;margin:0 calc(-1 * var(--gut)) 18px;padding:0 var(--gut) 4px;scrollbar-width:none}
  .btopic{flex:none}
}
@media (prefers-reduced-motion:reduce){
  .post-video-img img,.post-gal img,.bcard-img img{transition:none}
}

/* ---------- новости: /news/ и страница новости (templates/news.html, newsitem.html; тексты — tools/news.py) ---------- */
/* кадр целиком: рамка 3:2, фото вписано (object-fit:contain) — без обрезки станка и протокола */
.ncover{background:var(--paper)}
.ncover img{object-fit:contain!important}
.post-side{align-self:stretch}      /* колонка во всю высоту статьи — иначе .post-stick не прилипает (и в блоге) */
.nlist-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:56px;align-items:start}
.nlist-main{min-width:0}
.nyear{margin:0 0 30px}
.nyear-h{display:flex;align-items:center;gap:16px;margin:0;padding:6px 0;font:500 14px/1 var(--mono);letter-spacing:.08em;color:var(--muted)}
.nyear-h::after{content:"";flex:1;height:1px;background:var(--line)}
.nlist{list-style:none;margin:0;padding:0}
.nitem{border-bottom:1px solid var(--line-2)}
.nitem:last-child{border-bottom:0}
.nitem a{display:grid;grid-template-columns:280px minmax(0,1fr);gap:28px;align-items:start;padding:22px 0;color:var(--ink);text-decoration:none}
.nitem-img{position:relative;display:block;aspect-ratio:3/2;overflow:hidden}
.nitem-img img{position:absolute;inset:0;width:100%;height:100%;display:block;transition:transform .35s ease}
.nitem a:hover .nitem-img img{transform:scale(1.03)}
.nitem-b{display:flex;flex-direction:column;gap:10px;min-width:0;padding-top:2px}
.nitem-m{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;font-size:13.5px;color:var(--muted)}
.nitem b{font-size:clamp(20px,1.8vw,23px);font-weight:450;line-height:1.28;transition:color .15s}
.nitem a:hover b{color:var(--brand)}
.nitem-l{font-size:15.5px;line-height:1.55;color:var(--ink-2);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.nitem-f{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:13px;color:var(--muted)}
.nitem-f span+span::before{content:"·";margin-right:16px;margin-left:-8px;color:var(--line)}
.nlist-side{position:sticky;top:calc(var(--hdr) + 12px);display:grid;gap:14px}
.nlist-t{display:flex;justify-content:space-between;gap:10px;padding:7px 0;font-size:14.5px;line-height:1.35;color:var(--ink)}
.nlist-t i{font:500 13px/1.35 var(--mono);font-style:normal;color:var(--muted)}
.news .post-key{margin-bottom:32px}
.news .post-body .post-video{margin:1.6em 0 1.8em;clear:both}
.news .post-body .post-video-b .eyebrow{margin:0 0 8px;font-size:12px}
.news .post-body .post-video-b>p{margin:0 0 14px;font-size:15px}
.news .post-body .post-video a{text-decoration:none}
.news .post-body .post-video .btn-main{color:#fff}
.news .post-body .post-video .more{text-decoration:underline;text-underline-offset:3px}
.news-note{margin:0 0 1.4em!important;padding:14px 18px;background:#FFF6DC;border-left:3px solid #D99A00;font-size:16px;line-height:1.55}
.news .ptbl td:first-child{white-space:nowrap}
.bcards .bcard .ncover img,.bcard-img.ncover img{object-fit:contain}
@media (max-width:1000px){
  .nlist-grid{grid-template-columns:minmax(0,1fr);gap:8px}
  .nlist-side{position:static;grid-template-columns:repeat(2,minmax(0,1fr))}
  .nlist-side .post-cta{grid-column:1/-1}
}
@media (max-width:700px){
  .nitem a{grid-template-columns:minmax(0,1fr);gap:14px;padding:18px 0}
  .nitem b{font-size:19px}
  .nlist-side{grid-template-columns:minmax(0,1fr)}
  .news .pfig-side img{aspect-ratio:auto;object-fit:contain;max-height:520px;width:auto;margin:0 auto}   /* кадр целиком (протокол, станок) */
  .news .pfig-side a{display:flex;justify-content:center;background:var(--paper)}
  .news .ptbl{font-size:14px}
  .news .ptbl td:first-child{white-space:normal}
  .news .ptbl th,.news .ptbl td{padding:8px 9px}
}
@media (prefers-reduced-motion:reduce){.nitem-img img{transition:none}}
