/*
 * Blog — a copy of the previous hrgarant.ru blog (Blocksy theme): measurements,
 * colors and type taken from the live site's computed styles.
 * Loaded only on blog screens (inc/blog.php).
 */

.is-blog {
  --b-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --b-text: #4d5d6d;
  --b-heading: #102136;
  --b-accent: #7456f1;
  --b-accent-dark: #5e3fde;
  --b-border: #e7ebee;
  --b-shadow: 0 12px 18px -6px rgba(33, 55, 99, 0.11);
  background: #fff;
}

.blog-page {
  font-family: var(--b-font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--b-text);
  background: #fff;
}

.blog-container {
  width: 100%;
  max-width: 1338px;
  margin: 0 auto;
  padding: 60px 24px;
}

.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  gap: 52px;
  align-items: start;
}

.blog-heading {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--b-heading);
  margin-bottom: 30px;
}

/* --- Cards ------------------------------------------------------------- */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 5px;
  box-shadow: var(--b-shadow);
  overflow: hidden;
}

.blog-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.blog-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.blog-card:hover .blog-card__media img {
  transform: scale(1.03);
}

.blog-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 30px;
}

.blog-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.blog-badge {
  display: inline-flex;
  align-items: center;
  height: 25px;
  padding: 0 8px;
  border-radius: 3px;
  background: var(--b-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  transition: background 0.2s;
}

.blog-badge:hover {
  background: var(--b-accent-dark);
}

.blog-card__title {
  font-family: var(--b-font);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--b-heading);
  margin-bottom: 20px;
}

.blog-card__title a:hover {
  color: var(--b-accent);
}

.blog-card__excerpt {
  margin-bottom: 20px;
}

.blog-card__date {
  margin-top: auto;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

/* --- Pagination --------------------------------------------------------- */

.blog-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 60px;
}

.blog-pagination__pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.blog-pagination .page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 41px;
  height: 40px;
  border: 2px solid transparent;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--b-text);
}

.blog-pagination a.page-numbers:hover {
  border-color: var(--b-border);
}

.blog-pagination .page-numbers.current {
  background: var(--b-accent-dark);
  color: #fff;
}

.blog-pagination__side--next {
  text-align: right;
}

.blog-pagination__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 17px;
  border: 2px solid var(--b-border);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--b-text);
  transition: border-color 0.2s, color 0.2s;
}

.blog-pagination__btn:hover {
  border-color: var(--b-accent);
  color: var(--b-accent);
}

.blog-pagination__btn svg {
  width: 14px;
  height: 14px;
}

.blog-pagination__flip svg {
  transform: rotate(180deg);
}

/* --- Sidebar ------------------------------------------------------------ */

.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 50px;
}

.blog-widget__title,
.blog-sidebar .wp-block-heading {
  font-family: var(--b-font);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--b-heading);
  margin-bottom: 20px;
}

/* Categories dropdown */
.blog-sidebar .wp-block-categories-dropdown {
  position: relative;
}

.blog-sidebar .wp-block-categories-dropdown label {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.blog-sidebar select {
  width: 100%;
  height: 40px;
  padding: 0 25px 0 15px;
  border: 1px solid var(--b-border);
  border-radius: 3px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234d5d6d'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") right 8px center / 16px no-repeat;
  font: 16px var(--b-font);
  color: var(--b-text);
  appearance: none;
  cursor: pointer;
}

/* Latest posts with round thumbnails */
.blog-sidebar .wp-block-latest-posts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.blog-sidebar .wp-block-latest-posts li {
  display: grid;
  grid-template-columns: 82px 1fr;
  column-gap: 20px;
  align-items: center;
}

.blog-sidebar .wp-block-latest-posts__featured-image {
  grid-row: span 2;
  margin: 0;
}

.blog-sidebar .wp-block-latest-posts__featured-image img {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
}

.blog-sidebar .wp-block-latest-posts__post-title {
  align-self: end;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--b-heading);
}

.blog-sidebar .wp-block-latest-posts__post-title:hover {
  color: var(--b-accent);
}

.blog-sidebar .wp-block-latest-posts__post-date {
  align-self: start;
  margin-top: 8px;
  font-size: 13px;
  color: var(--b-text);
}

/* Downloadable forms */
.blog-sidebar .wp-block-file {
  margin: 0 0 22px 40px;
}

.blog-sidebar .wp-block-file a:not(.wp-block-file__button) {
  position: relative;
  display: block;
  padding-left: 28px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--b-heading);
}

.blog-sidebar .wp-block-file a:not(.wp-block-file__button)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 20px;
  height: 24px;
  background: var(--b-heading);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.6' d='M2 1h11l5 5v17H2z M13 1v5h5'/%3E%3Cpath d='M5 11h1.6l1 4.6 1.2-4.6h1.4l1.2 4.6 1-4.6H14l-1.9 7h-1.4L9.5 13.6 8.3 18H6.9z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 24'%3E%3Cpath fill='none' stroke='black' stroke-width='1.6' d='M2 1h11l5 5v17H2z M13 1v5h5'/%3E%3Cpath d='M5 11h1.6l1 4.6 1.2-4.6h1.4l1.2 4.6 1-4.6H14l-1.9 7h-1.4L9.5 13.6 8.3 18H6.9z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.blog-sidebar .wp-block-file a:hover {
  color: var(--b-accent);
}

.wp-block-file__name {
  display: block;
}

.wp-block-file__size {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--b-text);
}

.blog-sidebar .wp-block-file__button {
  display: none;
}

/* --- Post hero ---------------------------------------------------------- */

.post-hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 400px;
  padding: 50px 24px;
  background: var(--b-heading);
  text-align: center;
  overflow: hidden;
}

.post-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(16, 33, 54, 0.62);
}

.post-hero--plain::after {
  display: none;
}

.post-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 750px;
}

.post-hero .blog-badges {
  justify-content: center;
}

.post-hero__title {
  font-family: var(--b-font);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
  color: #e7ebee;
  margin-bottom: 20px;
}

.post-hero__date {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #e7ebee;
}

/* --- Post content ------------------------------------------------------- */

.post-content {
  font-size: 15px;
  line-height: 1.75;
}

.post-content > * + * {
  margin-top: 1.4em;
}

.post-content h2 {
  font-family: var(--b-font);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--b-heading);
  margin-top: 1.2em;
}

.post-content h3,
.post-content h4 {
  font-family: var(--b-font);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--b-heading);
}

.post-content strong {
  font-weight: 700;
}

.post-content a {
  color: var(--b-accent);
  text-decoration: underline;
}

.post-content ul,
.post-content ol {
  padding-left: 40px;
  font-size: 16px;
}

.post-content ul {
  list-style: disc;
}

.post-content ol {
  list-style: decimal;
}

/* Styled lists (check marks, dots) space their items with a gap already. */
.post-content :is(ul, ol):not(.is-style-check, .is-style-dots) li + li {
  margin-top: 0.4em;
}

.post-content li::marker {
  color: var(--b-accent);
  font-weight: 700;
}

/* A heading leads straight into its text. */
.post-content h2 + *,
.post-content h3 + * {
  margin-top: 0.6em;
}

/* Quotes: a purple rule and the speaker under the text. */
.post-content .wp-block-quote {
  margin-left: 0;
  margin-right: 0;
  padding: 6px 0 6px 28px;
  border-left: 4px solid var(--b-accent);
  font-size: 19px;
  line-height: 1.6;
  font-style: italic;
  color: var(--b-heading);
}

.post-content .wp-block-quote p + p {
  margin-top: 0.8em;
}

.post-content .wp-block-quote cite {
  display: block;
  margin-top: 12px;
  font-size: 14px;
  font-style: normal;
  font-weight: 600;
  color: var(--b-text);
}

.post-content .wp-block-quote cite::before {
  content: "— ";
}

.post-content .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.post-content .wp-block-table th,
.post-content .wp-block-table td {
  padding: 10px 14px;
  border: 1px solid #e3e7eb;
  text-align: left;
  vertical-align: top;
}

.post-content .wp-block-table th {
  background: #f3f5f7;
  color: var(--b-heading);
}

.post-content img {
  height: auto;
  border-radius: 5px;
}

/* Cases: client task box */
.post-content .is-style-case-task {
  padding: 26px;
  border-radius: 8px;
  background: #f3f5f7;
}

.post-content .is-style-case-task > * + * {
  margin-top: 10px;
}

.post-content .case-subtitle,
.post-content .is-style-case-task h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--b-heading);
}

/* Lists with check marks / purple dots */
.post-content ul.is-style-check,
.post-content ul.is-style-dots {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-left: 0;
  list-style: none;
  font-size: 15px;
}

.post-content .is-style-check li,
.post-content .is-style-dots li {
  position: relative;
  padding-left: 37px;
}

.post-content .is-style-check li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 6px;
  width: 14px;
  height: 14px;
  background: var(--b-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.post-content .is-style-dots li::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--b-accent);
}

/* The «Скидка 80%» call to action at the end of a case: centered, as before */
.post-content .banner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 30px;
  padding: 70px 40px;
  border-radius: 6px;
  margin-top: 60px;
}

.post-content .banner .banner__title {
  max-width: 640px;
  margin: 0 auto;
  font-family: var(--b-font);
  font-size: 30px;
  line-height: 1.35;
  color: #fff;
}

.post-content .banner .banner__side {
  justify-content: center;
}

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

@media (max-width: 1080px) {
  .blog-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .blog-container {
    padding: 40px 16px;
  }

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

  .post-hero {
    min-height: 320px;
  }

  .post-hero__title {
    font-size: 24px;
  }

  .post-content h2 {
    font-size: 23px;
  }

  .blog-pagination {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .blog-pagination__side--next {
    text-align: center;
  }
}
