/* ============================================================
   BLOG (listing + rubric archives + article)
   Loaded only on blog views, after main.css (see inc/blog.php)
   ============================================================ */

/* ---------- Listing ---------- */

.blog {
  padding-bottom: 40px;
}

.blog h1 {
  color: var(--color-black);
  margin-bottom: 20px;
}

.blog__intro {
  max-width: 760px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-black);
  margin-bottom: 28px;
}

.blog__intro a {
  color: var(--color-first);
  text-decoration: none;
}

.blog__intro a:hover {
  text-decoration: underline;
}

.blog__empty {
  font-size: 16px;
  color: var(--color-black);
  opacity: 0.7;
  margin: 40px 0;
}

/* ---------- Related slider on the article page ---------- */

/* Nav row, bullets and arrows all come from the shared slider styles in
   main.css (.swiper__nav, .swiper-button-wrapper), same look as the reviews
   slider on the front page. Local rules only handle what is specific here. */
.blog-related__slider {
  overflow: hidden;
}

.blog-related__slider .swiper-slide {
  height: auto;
  display: flex;
}

.blog-related__slider .swiper-slide > * {
  width: 100%;
}

/* The section ends right after the slider, so the shared 50px bottom margin of
   .swiper__nav would double the footer gap. Not zero though: the arrows grow to
   110% on hover and need those few pixels, or the container edge clips them. */
.blog-related__nav {
  margin-bottom: 4px;
  padding-right: 4px;
}

/* ---------- Rubric text under the listing ---------- */

/* Sits after the cards and the pagination, so the grid keeps the first screen.
   Separated by a rule rather than by spacing alone, otherwise it reads as one
   more card. Links follow the article-body style: bold, not coloured. */
/* The gap below the block matches the gap above it, so the text sits evenly
   between the cards and the footer. The section's own bottom padding is dropped
   when the block is present, otherwise the two would stack. */
.blog:has(.blog__outro) {
  padding-bottom: 0;
}

.blog__outro {
  margin-top: 56px;
  padding-top: 32px;
  padding-bottom: 56px;
  border-top: 1px solid #e6e6e6;
}

.blog__outro h2 {
  font-size: 22px;
  line-height: 1.3;
  color: var(--color-black);
  margin: 0 0 14px;
}

.blog__outro p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-black);
  margin: 0 0 14px;
}

.blog__outro ul {
  margin: 0 0 14px;
  padding-left: 20px;
  list-style: disc;
}

.blog__outro li {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-black);
  margin-bottom: 8px;
}

.blog__outro p:last-child,
.blog__outro ul:last-child,
.blog__outro li:last-child {
  margin-bottom: 0;
}

.blog__outro a {
  color: var(--color-black);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.blog__outro a:hover {
  color: #686767;
}

/* Long SEO lines on wide screens: same measure as .blog__intro */
@media (min-width: 1100px) {
  .blog__outro p,
  .blog__outro ul {
    max-width: 760px;
  }

  .blog__outro li {
    text-wrap: balance;
  }
}

@media (max-width: 767px) {
  .blog__outro {
    margin-top: 40px;
    padding-top: 24px;
    padding-bottom: 40px;
  }

  .blog__outro h2 {
    font-size: 20px;
  }
}

/* ---------- Rubric buttons ---------- */

.blog-rubrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 36px;
}

.blog-rubrics__item {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border: 1px solid #d9d9e3;
  border-radius: 100px;
  background: var(--bg-white);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--color-black);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

a.blog-rubrics__item:hover {
  border-color: var(--color-first);
  color: var(--color-first);
}

.blog-rubrics__item.is-current {
  background: var(--color-first);
  border-color: var(--color-first);
  color: #fff;
}

/* ---------- Search ---------- */

.search .blog > .container > h1 {
  overflow-wrap: anywhere;
}

.blog-search {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 0 36px;
}

/* Global form rules (form input = 70px left padding; input:focus-visible =
   offset square a11y outline) leak into the search field. Overrides below are
   scoped to .blog-search only - site contact forms stay untouched. */
.blog-search input.blog-search__input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: 48px;
  padding: 0 18px;
  border: 1px solid #d9d9e3;
  border-radius: 100px;
  background: var(--bg-white);
  font-size: 15px;
  line-height: normal;
  color: var(--color-black);
}

.blog-search input.blog-search__input:focus,
.blog-search input.blog-search__input:focus-visible {
  outline: none;
  border-color: var(--color-first);
}

.blog-search__btn {
  flex: 0 0 auto;
  height: 48px;
  padding: 0 26px;
  border: none;
  border-radius: 100px;
  background: var(--color-first);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.blog-search__btn:hover {
  background: #b52424;
}

.blog-search__count {
  font-size: 14px;
  color: #5f6784;
  margin: 0 0 20px;
}

/* ---------- Tag archive header ---------- */

.blog-tag-archive__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-first);
  margin: 0 0 6px;
}

.blog-tag-archive__title {
  color: var(--color-black);
  margin: 0 0 20px;
}

/* Tag/topic chip styles removed with the tags themselves (owner decision 20.07).
   Navigation is rubrics + search + related; the tag-archive heading styles below
   stay because /blog/tag/<slug>/ still renders if someone lands on it directly. */

/* ---------- Card grid ---------- */

.blog__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.blog-card {
  min-width: 0;
}

.blog-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-white);
  border: 1px solid #e6e6e6;
  border-radius: 24px;
  overflow: hidden;
  text-decoration: none;
  color: var(--color-black);
  /* site-wide card shadow (portfolio items use the same pair) */
  box-shadow: 0 -5px 40px -1px rgba(79, 79, 79, 0.05), 0 30px 30px -15px rgba(79, 79, 79, 0.07);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.blog-card__link:hover {
  border-color: #d5d5dd;
  box-shadow: 0 -5px 40px -1px rgba(79, 79, 79, 0.08), 0 30px 34px -15px rgba(79, 79, 79, 0.12);
}

/* cover blends with the page background - a hairline keeps the card readable */
.blog-card__img {
  border-bottom: 1px solid #ececf2;
}

.blog-card__img {
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  background: #eef0f6;
}

.blog-card__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card__img-fallback {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f2f3f8 0%, #e4e7f2 100%);
}

.blog-card__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 20px 24px 24px;
}

.blog-card__meta {
  margin-bottom: 10px;
}

.blog-card__rubric {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-first);
}

.blog-card__title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-black);
  margin: 0 0 10px;
}

.blog-card__descr {
  font-size: 14px;
  line-height: 1.5;
  color: #4a4f6e;
  margin: 0 0 16px;
}

.blog-card__bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 13px;
  color: #5f6784;
}

/* ---------- Pagination (portfolio series look) ---------- */

.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 48px 0 8px;
}

.blog-pagination__num,
.blog-pagination__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #d9d9e3;
  border-radius: 10px;
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

a.blog-pagination__num:hover,
a.blog-pagination__arrow:hover {
  border-color: var(--color-first);
  color: var(--color-first);
}

.blog-pagination__num.is-current {
  background: var(--color-first);
  border-color: var(--color-first);
  color: #fff;
}

.blog-pagination__status {
  margin: 0 0 8px;
  text-align: center;
  font-size: 14px;
  opacity: 0.6;
}

/* phones: all page numbers and the arrow stay in one row */
@media (max-width: 460px) {
  .blog-pagination {
    gap: 4px;
  }

  .blog-pagination__num,
  .blog-pagination__arrow {
    min-width: 32px;
    padding: 0 6px;
  }
}

/* ---------- Article ---------- */

.blog-article {
  padding-bottom: 20px;
}

/* article uses the site-wide .container width (owner 19.07: no narrow column) */

.blog-article__header {
  margin-bottom: 28px;
}

.blog-article__rubric {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-first);
  text-decoration: none;
  margin-bottom: 14px;
}

.blog-article__rubric:hover {
  text-decoration: underline;
}

.blog-article__title {
  color: var(--color-black);
  margin: 0 0 16px;
}

.blog-article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #5f6784;
}

.blog-article__meta time {
  color: #4a4f6e;
}

@media (max-width: 340px) {
  .blog-article__meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .blog-article__dot {
    display: none;
  }
}

/* ---------- Article layout: sticky TOC sidebar left, content right ---------- */

.blog-article__layout {
  display: grid;
  /* owner-tuned in devtools 19.07: wider TOC column, tighter gap */
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.blog-article__layout--no-toc {
  grid-template-columns: 1fr;
}

.blog-article__aside {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.blog-article__main {
  min-width: 0;
}

/* ---------- TOC ---------- */

.blog-toc {
  background: var(--bg-white);
  border: 1px solid var(--color-border-gray);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 32px;
}

.blog-toc--sidebar {
  margin-bottom: 0;
}

/* color only: a weight change would reflow line wraps and make the list jump.
   Exactly one item is lit at a time, h2 or h3 alike: a second, dimmer highlight
   on the parent section was tried and read as an unfinished state. */
.blog-toc__item.is-current > a {
  color: var(--color-first);
}

.blog-toc__item > a {
  transition: color 0.2s ease;
}

.blog-toc__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-black);
  margin: 0 0 12px;
}

.blog-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  counter-reset: toc;
}

.blog-toc__item a {
  font-size: 15px;
  line-height: 1.4;
  color: var(--color-black);
  text-decoration: none;
}

.blog-toc__item a:hover {
  color: var(--color-first);
}

.blog-toc__item--l2 {
  counter-increment: toc;
  /* each section restarts its sub-item numbering (3.1, 3.2, ...) */
  counter-reset: tocsub;
}

.blog-toc__item--l2 a::before {
  content: counter(toc) ". ";
  font-weight: 600;
  color: var(--color-first);
}

.blog-toc__item--l3 {
  padding-left: 20px;
  counter-increment: tocsub;
}

.blog-toc__item--l3 a {
  font-size: 14px;
  color: var(--color-black);
}

.blog-toc__item--l3 a::before {
  content: counter(toc) "." counter(tocsub) " ";
  font-weight: 600;
  color: var(--color-first);
}

/* Anchor jumps land below the fixed header with room to breathe. The header is
   74px, so the old 90px left only 16px of air and the heading read as glued to
   the top. Applied to the element itself so it covers both the TOC click and a
   plain #hash entry from search results.
   h3 gets 20px more than h2 on purpose: h2 carries padding-top: 20px, so its
   letters start that much below the border box that the anchor aligns. With one
   shared value the sub-heading landed 20px higher and looked cramped next to it. */
.blog-article__content h2[id] {
  scroll-margin-top: 104px;
}

.blog-article__content h3[id] {
  scroll-margin-top: 124px;
}

@media (max-width: 767px) {
  .blog-article__content h2[id] {
    scroll-margin-top: 84px;
  }

  .blog-article__content h3[id] {
    scroll-margin-top: 104px;
  }
}

/* ---------- Article content extras on top of .text-page-content ---------- */

.blog-article__content {
  font-size: 16px;
}

/* Clear heading hierarchy: the base .text-page-content sizes (h2 24 / h3 20)
   read almost identically at full width - sections must dominate visually */
.blog-article__content h2 {
  font-size: 30px;
  margin-top: 56px;
  margin-bottom: 20px;
}

.blog-article__content h3 {
  font-size: 19px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.blog-article__content > h2:first-child {
  margin-top: 0;
}

.blog-article__content img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}

.blog-article__content blockquote {
  margin: 24px 0;
  padding: 16px 24px;
  border-left: 3px solid var(--color-first);
  background: var(--bg-white);
  border-radius: 0 12px 12px 0;
}

/* comparison tables (added in article bodies for SEO/scannability) */
.blog-article__content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e6e6ee;
  margin: 24px 0;
  font-size: 15px;
  border-radius: 12px;
  overflow: hidden;
}

.blog-article__content th,
.blog-article__content td {
  border-right: 1px solid #e6e6ee;
  border-bottom: 1px solid #e6e6ee;
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

/* Separate borders keep the rounded frame closed: the table draws the outer line,
   cells draw only the inner ones. */
.blog-article__content tr > :last-child {
  border-right: 0;
}

.blog-article__content tbody tr:last-child > * {
  border-bottom: 0;
}

.blog-article__content thead th {
  background: #f4f5f9;
  color: var(--color-black);
  font-weight: 700;
}

.blog-article__content tbody tr:nth-child(even) {
  background: #fafafb;
}

@media (max-width: 767px) {
  .blog-article__content table {
    font-size: 13px;
  }

  .blog-article__content th,
  .blog-article__content td {
    padding: 9px 11px;
  }
}

/* ---------- Lead forms in the article ---------- */

.blog-form {
  margin: 32px 0;
}

/* The TOC sidebar narrows the content column: three contact fields in a row
   truncate their placeholders at any viewport, so whenever the sidebar is
   present the fields stack. Without a TOC (full-width column) they stay in a row. */
@media (min-width: 1100px) {
  .blog-article__layout:not(.blog-article__layout--no-toc) .blog-form .row--contacts {
    flex-wrap: wrap;
  }

  .blog-article__layout:not(.blog-article__layout--no-toc) .blog-form .row--contacts .col {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
}

.blog-form .project-form__wrapper {
  padding: 24px 28px;
  /* same rounding as the TOC sidebar card */
  border-radius: 16px;
}

.blog-form.project-form,
.blog-form .project-form__wrapper {
  border-radius: 16px;
  overflow: hidden;
}

/* Compact vertical rhythm: the stacked fields made the form very tall */
.blog-form .row--contacts .col,
.blog-form .form_input_wrap {
  margin-bottom: 12px;
}

.blog-form .form_input_wrap input:not(.wpcf7-submit),
.blog-form input[type="text"],
.blog-form input[type="tel"],
.blog-form input[type="email"] {
  padding-top: 11px;
  padding-bottom: 11px;
}

.blog-form .form_input_wrap textarea,
.blog-form textarea {
  /* main.css pins 110px on the same specificity - important wins reliably */
  height: 84px !important;
  min-height: 84px !important;
  padding-top: 12px;
  padding-bottom: 12px;
}

.blog-form .contact-method-wrap {
  margin-top: 12px !important;
  margin-bottom: 10px !important;
}

.blog-form .messengers-grid label {
  padding: 8px 12px !important;
}

.blog-form input[type="submit"],
.blog-form button[type="submit"] {
  margin-top: 10px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.blog-form .descr {
  margin-bottom: 14px;
}

.blog-form__title {
  margin-top: 0;
}

/* the intro slot lives inside .text-page-content - neutralize its h2 spacing */
.blog-article__content .blog-form h2 {
  margin-top: 0;
}

/* ---------- Related ---------- */

.blog-related {
  padding: 20px 0 50px;
}

.blog-related__title {
  color: var(--color-black);
  margin-bottom: 24px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1099px) {
  .blog__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* sidebar collapses: TOC becomes a regular block above the content */
  .blog-article__layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .blog-article__aside {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 28px;
  }
}

/* Two columns on tablets: an odd last card would stand alone at the left edge, so it goes to the center */
@media (min-width: 768px) and (max-width: 1099px) {
  .blog__grid > .blog-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 12px);
  }
}

@media (max-width: 767px) {
  .blog__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .blog-card__body {
    padding: 16px 18px 20px;
  }

  .blog-rubrics {
    gap: 8px;
    margin-bottom: 28px;
  }

  .blog-rubrics__item {
    padding: 9px 14px;
    font-size: 13px;
  }

  .blog-toc {
    padding: 18px 20px;
  }

  .blog-form .project-form__wrapper {
    padding: 24px 18px;
  }

  .blog-article__content h2 {
    font-size: 24px;
    margin-top: 40px;
  }

  .blog-article__content h3 {
    font-size: 17px;
    margin-top: 26px;
  }
}

/* In-body article links follow the site pattern (about-us content links):
   bold black with a gray hover - NOT the red underlined .text-page-content
   default that the shared content class would otherwise apply. */
.blog-article__content a {
  color: var(--color-black);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.blog-article__content a:hover {
  color: #686767;
}

/* Wide comparison tables scroll inside their own wrapper on small screens. */
.blog-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0;
}

.blog-table-wrap .blog-article__content table,
.blog-table-wrap table {
  min-width: 560px;
  margin: 0;
}

/* Two-column tables fit a phone screen and wrap text inside cells; tables with
   three or more columns keep min-width 560px and scroll inside the wrapper. */
@media (max-width: 767px) {
  .blog-table-wrap table:not(:has(tr > :nth-child(3))) {
    min-width: 0;
  }
}

/* --- Author box under the article (E-E-A-T, owner 11.08) -----------------
   Company byline: the owner decided against named authors, so the block earns
   its place with proof instead of a persona - a case from the same service as
   the article. Quieter than the lead form below it: this block builds trust,
   the form does the asking. */
.blog-author {
  padding: 24px;
  margin: 40px 0 0;
  border: 1px solid #e6e6e6;
  border-radius: 24px;
  background: #fafafb;
}

.blog-author__title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.4;
  color: #0d1344;
}

.blog-author__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #4a4f6e;
}

/* The case is the payload of the block, so it reads as a card inside a card. */
.blog-author__case {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #e6e6e6;
  border-radius: 16px;
  background: #fff;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.blog-author__case:hover {
  border-color: #d9d9e3;
  transform: translateY(-1px);
}

.blog-author__case-media {
  flex: 0 0 auto;
  width: 96px;
  height: 64px;
  overflow: hidden;
  border-radius: 10px;
  background: #eef0f6;
}

/* Case images are full-page screenshots in portrait, so a centred crop lands on
   a meaningless slice of body text. Anchoring to the top shows the hero screen,
   which is what makes a project recognisable (compared side by side 11.08). */
.blog-author__case-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.blog-author__case-body {
  min-width: 0;
}

.blog-author__case-label {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: #5f6784;
}

.blog-author__case-title {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: #0d1344;
}

.blog-author__links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 18px 0 0;
}

.blog-author__link {
  font-size: 15px;
  font-weight: 600;
  color: #0d1344;
  text-decoration: none;
  border-bottom: 1px solid #d9d9e3;
  transition: color 0.2s, border-color 0.2s;
}

.blog-author__link:hover {
  color: #686767;
  border-bottom-color: #686767;
}

@media (max-width: 700px) {
  .blog-author {
    padding: 20px;
  }

  .blog-author__case-media {
    width: 72px;
    height: 52px;
  }
}

/* C22: article and listing copy follow the site-wide in-text link style (main.css).
   These selectors live here because blog.css loads after main.css. */
.blog-article__content a,
.blog__outro a,
.blog__intro a {
  color: var(--color-black);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(13, 19, 68, 0.35);
  text-underline-offset: 3px;
  text-decoration-skip-ink: auto;
  transition: text-decoration-color 0.2s, color 0.2s;
}

.blog-article__content a:hover,
.blog__outro a:hover,
.blog__intro a:hover {
  color: var(--color-black);
  text-decoration-color: var(--color-black);
  opacity: 1;
}
.blog h1{text-wrap:balance}

/* Keep article list line spacing consistent with body paragraphs. */
.blog-article__content ol,
.blog-article__content ul {
  line-height: 1.5;
}
