/*
 * brushai.ru/blog — articles in the app's «Что нового» manner: a large
 * left-aligned title, then each section as a full-width band, bands
 * alternating white and soft. Tokens come from site.css.
 */

.post, .blog-index { --col: 720px; --wide: 980px; --aside: 272px; }

/* One centred reading column, as an article is read. */
.post-grid {
  width: 100%; max-width: calc(var(--col) + 40px); margin: 0 auto; padding: 0 20px;
}

/* ---------- Head ---------- */
.post-head { padding: calc(var(--header) + 36px) 0 40px; background: var(--bg); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--faint); }
.post-head h1 {
  max-width: 20ch; font-size: clamp(32px, 4.6vw, 52px); line-height: 1.06; font-weight: 700; letter-spacing: -0.03em;
}
.post-lead { margin-top: 18px; max-width: 58ch; font-size: 19px; line-height: 1.55; color: #4a5163; }
.post-meta { margin-top: 18px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.post-toc { display: none; }

/* ---------- Bands ---------- */
.band { padding: 44px 0; }
.band-white { background: var(--card); }
.band-soft { background: var(--bg); }
.band h2 { max-width: 24ch; font-size: clamp(25px, 2.7vw, 32px); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; scroll-margin-top: calc(var(--header) + 20px); }
.band h3 { margin-top: 30px; font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }

.prose { font-size: 17px; line-height: 1.65; color: var(--text); }
.prose > * { max-width: var(--col); }
.prose > .wide { max-width: none; }
/* Siblings are spaced by one rule: a screen moved aside on wide screens
   still sits between them in the document. */
.prose > * + * { margin-top: 14px; }
.prose > h2 + * { margin-top: 16px; }
.prose > h3 + * { margin-top: 8px; }
.prose strong, .prose b { color: var(--ink); font-weight: 600; }
.prose a:not(.btn) { color: var(--blue-ink); text-decoration: underline; text-decoration-color: rgba(68, 80, 214, 0.3); text-underline-offset: 3px; }
.prose a:not(.btn):hover { text-decoration-color: currentColor; }
.prose ul, .prose ol { display: grid; gap: 8px; }
.prose ul li { position: relative; padding-left: 24px; }
.prose ul li::before { content: ""; position: absolute; left: 4px; top: 0.66em; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.prose ol { counter-reset: step; }
.prose ol li { position: relative; padding-left: 36px; counter-increment: step; }
.prose ol li::before {
  content: counter(step); position: absolute; left: 0; top: 0.12em; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.prose blockquote {
  margin: 22px 0 0; padding: 0; font-size: 21px; line-height: 1.4; font-weight: 600; color: var(--ink); letter-spacing: -0.01em;
}
.prose blockquote p + p { margin-top: 8px; }
.prose blockquote cite { display: block; margin-top: 8px; font-size: 15px; font-style: normal; font-weight: 400; color: var(--muted); }

/* The same thought before and after editing. */
.rewrite { display: grid; gap: 10px; margin-top: 22px; }
.rewrite p { margin: 0; padding: 14px 18px; border-radius: 18px; font-size: 17px; line-height: 1.45; }
.rewrite span { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.rewrite .was { background: var(--bg); color: var(--muted); }
.band-soft .rewrite .was { background: var(--card); }
.rewrite .now { background: var(--blue-soft); color: #1d2260; font-weight: 600; }
.rewrite .now span { color: var(--blue-ink); }

/* A phone screen of the app, as it is. */
.shot { margin: 30px auto 0; width: min(100%, 280px); }
.shot img { width: 100%; height: auto; border-radius: 30px; border: 1px solid var(--line-strong); background: var(--card); box-shadow: var(--shadow); }
.shot figcaption { margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--muted); }

/* A wide picture inside the text column. */
.figure { margin: 30px 0 0; }
.figure img { width: 100%; height: auto; border-radius: 20px; border: 1px solid var(--line); }
.figure figcaption { margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.strip { overflow-x: auto; scrollbar-width: thin; border-radius: 20px; }
.strip img { width: auto; max-width: none; height: 300px; border-radius: 0; border: 0; }

/* «Во Вжухе»: where the app does a step for you. */
.inapp {
  display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 4px 14px; align-items: start;
  margin-top: 26px; padding: 18px 20px; border-radius: 20px; background: var(--bg); font-size: 16px; line-height: 1.55;
}
.band-soft .inapp { background: var(--card); }
.inapp img { grid-row: span 2; width: 32px; height: 32px; border-radius: 9px; }
.inapp p { margin: 0; }
.inapp p + p { margin-top: 0; }
.inapp .inapp-title { font-weight: 600; color: var(--ink); }

/* Two slide covers side by side: what gets swiped past and what gets opened. */
.covers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.cover { margin: 0; min-width: 0; }
.cover-label { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.cover-label .icon { width: 18px; height: 18px; }
.cover.is-weak .cover-label .icon { color: #b7bbc6; }
.cover.is-strong .cover-label { color: var(--ink); }
.cover.is-strong .cover-label .icon { color: var(--green); }
.cover-card {
  aspect-ratio: 4 / 5; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  padding: clamp(14px, 3vw, 22px); border-radius: 16px; overflow: hidden;
  background: #eceef3; color: #5c6273; font-size: clamp(14px, 2.6vw, 19px); line-height: 1.2; font-weight: 600;
}
.cover-card small { font-size: 0.62em; font-weight: 500; opacity: 0.75; }
.cover.is-strong .cover-card { background: var(--primary); color: #fff; font-size: clamp(17px, 3.3vw, 24px); font-weight: 700; letter-spacing: -0.02em; }
.cover-card mark { background: #ff4fa3; color: #fff; padding: 0 0.15em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.cover-card .count { align-self: flex-end; font-size: 0.55em; font-weight: 600; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* Real slides rendered by the app's templates. */
.slide-img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 14px; background: var(--seg); }
.covers .slide-img { border-radius: 16px; box-shadow: var(--shadow); }

/* A whole carousel, swiped sideways like in the feed. */
.carousel-strip { margin: 28px 0 0; }
.prose .carousel-strip ol {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin: 0 -20px; padding: 4px 20px 16px; scroll-padding-inline: 20px; scrollbar-width: thin; scrollbar-color: #c9cdd8 transparent;
}
.prose .carousel-strip li { flex: none; width: min(62vw, 236px); scroll-snap-align: start; padding: 0; }
.prose .carousel-strip li::before { content: none; }
.carousel-strip .slide-img { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 26px rgba(35, 42, 68, 0.1); }
.carousel-strip figcaption { margin-top: 4px; font-size: 14px; line-height: 1.45; color: var(--muted); }

/* One thought, several templates. */
.cover-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.cover-grid figure { margin: 0; }
.cover-grid .slide-img { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 26px rgba(35, 42, 68, 0.1); }
.cover-grid figcaption { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.cover-grid + .grid-note { font-size: 14px; color: var(--muted); }

/* A slide with the parts the feed and the profile grid take away. */
.safezone { margin: 28px 0 0; max-width: 340px; }
.safezone-frame { position: relative; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.safezone-frame .slide-img { border-radius: 0; }
.safezone-frame .crop { position: absolute; top: 0; bottom: 0; width: 3.2%; background: rgba(255, 79, 163, 0.55); }
.safezone-frame .crop.l { left: 0; } .safezone-frame .crop.r { right: 0; }
.safezone-frame .safe { position: absolute; inset: 7.4% 7.4%; border: 2px dashed rgba(83, 71, 229, 0.9); border-radius: 6px; }
.safezone-frame .counter { position: absolute; top: 2.6%; right: 3%; padding: 3px 9px; border-radius: 999px; background: rgba(17, 17, 20, 0.62); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.safezone figcaption { display: grid; gap: 6px; margin-top: 14px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.safezone .key { display: inline-block; width: 18px; height: 12px; margin-right: 8px; vertical-align: -1px; border-radius: 3px; }
.safezone .key.crop-key { background: rgba(255, 79, 163, 0.55); }
.safezone .key.safe-key { border: 2px dashed rgba(83, 71, 229, 0.9); }

/* Reference tables: a grouped list, as in the app's settings. */
.table-wrap { margin-top: 24px; overflow-x: auto; border-radius: 20px; border: 1px solid var(--line); background: var(--card); }
.band-white .table-wrap { background: var(--bg); border-color: transparent; }
.table-wrap table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.table-wrap th, .table-wrap td { padding: 13px 16px; text-align: left; vertical-align: top; }
.table-wrap th { font-size: 13px; font-weight: 600; color: var(--muted); }
.table-wrap td { border-top: 1px solid var(--line); }
.table-wrap td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }

.answer { margin-top: 22px; padding: 18px 20px; border-radius: 20px; background: var(--blue-soft); color: #262c6e; font-size: 17px; line-height: 1.55; }
.answer strong { color: #1d2260; }
.answer p + p { margin-top: 8px; }

/* ---------- Questions ---------- */
.faq h3:first-of-type { margin-top: 22px; }

/* ---------- Next step ---------- */
.post-cta { padding: 56px 0; background: var(--card); text-align: left; }
.post-cta h2 { max-width: 20ch; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.08; font-weight: 700; letter-spacing: -0.03em; }
.post-cta p { margin-top: 14px; max-width: 46ch; font-size: 18px; line-height: 1.5; color: var(--muted); }
.post-cta .btn { margin-top: 26px; }
.post-cta .post-footnote { margin-top: 44px; max-width: 70ch; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* ---------- More to read ---------- */
.more { padding: 44px 0 56px; background: var(--bg); }
.more h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.links { margin-top: 16px; max-width: var(--col); background: var(--card); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.links a { display: grid; grid-template-columns: minmax(0, 1fr) 20px; gap: 4px 14px; align-items: center; padding: 16px 18px; text-decoration: none; color: var(--text); transition: background-color 0.2s; }
.links li + li a { border-top: 1px solid var(--line); }
.links a:hover { background: #fafbfd; }
.links strong { color: var(--ink); font-size: 17px; font-weight: 600; line-height: 1.3; }
.links span { grid-column: 1; font-size: 15px; line-height: 1.45; color: var(--muted); }
.links .icon { grid-column: 2; grid-row: 1 / span 2; width: 18px; height: 18px; color: var(--faint); }

/* ---------- Blog index ---------- */
.blog-list { display: grid; gap: 14px; margin-top: 8px; }
.blog-item {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 16px; align-items: center;
  padding: 14px; border-radius: 24px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.blog-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.blog-item img { width: 92px; height: 116px; object-fit: cover; object-position: top; border-radius: 14px; border: 1px solid var(--line); }
.blog-item h2 { font-size: 19px; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; }
.blog-item p { margin-top: 6px; font-size: 15px; line-height: 1.45; color: var(--muted); }
.blog-item .post-meta { margin-top: 8px; font-size: 13px; }

@media (min-width: 640px) {
  .post-grid { padding: 0 32px; }
  .band { padding: 56px 0; }
  .prose { font-size: 18px; line-height: 1.7; }
  .covers { gap: 18px; max-width: 520px; }
  .cover-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .prose .carousel-strip ol { margin: 0 -32px; padding-inline: 32px; scroll-padding-inline: 32px; }
  .blog-item { grid-template-columns: 132px minmax(0, 1fr); gap: 22px; padding: 16px; }
  .blog-item img { width: 132px; height: 165px; }
  .blog-item h2 { font-size: 22px; }
  .blog-item p { font-size: 16px; }
}

@media (min-width: 640px) {
  .post-grid { max-width: calc(var(--col) + 64px); padding: 0 32px; }
}

@media (min-width: 1024px) {
  .post-head { padding: calc(var(--header) + 56px) 0 56px; }
  .band { padding: 72px 0; }
  .post-cta { padding: 80px 0; }
  .shot img { border-radius: 32px; }
  .prose .carousel-strip ol { margin: 0; padding: 4px 0 16px; scroll-padding-inline: 0; }
  .prose .carousel-strip li { width: 214px; }
  /* Slides, strips and tables step out of the column on both sides. */
  .prose > .wide { margin-left: calc((var(--col) - var(--wide)) / 2); margin-right: calc((var(--col) - var(--wide)) / 2); }
}

/* Room in the right margin: the app screen of a section rides there while
   the section is read, and the contents sit there in the head. */
@media (min-width: 1360px) {
  .post-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) var(--col) minmax(0, 1fr); column-gap: 56px;
    max-width: none; padding: 0 32px;
  }
  .post-grid > * { grid-column: 2; }
  .post-grid > .btn { justify-self: start; }
  .post-grid > .shot, .post-grid > .post-toc {
    grid-column: 3; grid-row: 1 / span 60; justify-self: start; align-self: start;
    position: sticky; top: calc(var(--header) + 28px); width: var(--aside); margin: 0;
  }
  .post-grid > .post-toc { position: static; padding-top: 6px; }
  .post-toc { display: block; font-size: 15px; line-height: 1.4; }
  .post-toc p { font-size: 13px; font-weight: 600; color: var(--muted); }
  .post-toc ol { margin-top: 10px; display: grid; gap: 2px; border-left: 1px solid var(--line-strong); }
  .post-toc a { display: block; padding: 6px 0 6px 16px; color: var(--text); text-decoration: none; }
  .post-toc a:hover { color: var(--blue-ink); }
}
