/* ==========================================================================
   Content pages: blog (index + article), static pages, unsubscribe and error pages.
   Loaded after base.css + cards.css. The standalone error page (errors/minimal-ip)
   links base.css + this file on its own. Article cards come from cards.css.
   ========================================================================== */

/* ---------- Shared bits ---------- */
/* Lists of cards rendered as <ul> (blog grid, related posts, offers inside an article) */
.post-list, .inline-offers { list-style: none; }
.post-list > li, .inline-offers > li { display: flex; min-width: 0; }
.post-list > li > *, .inline-offers > li > * { flex: 1 1 auto; }

/* Author + date + reading time line (featured post, article head) */
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 0.875rem; line-height: 1.4; color: var(--muted); }
.article-meta > * { display: inline-flex; align-items: center; gap: 6px; }
.article-meta i { font-size: 16px; }
.author { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--navy); }
.author__avatar {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-50); color: var(--blue-700); font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.02em;
}

/* ---------- Blog index ---------- */
.blog-filters { margin-bottom: 32px; }

/* Featured post: big photo left, text right, flat (no box), the title link covers the whole block */
.post-feature {
  position: relative; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: center;
  margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px solid var(--line); color: var(--text);
}
.post-feature__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r-lg); background: var(--soft-2); }
.post-feature__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.post-feature:hover .post-feature__media img { transform: scale(1.03); }
.post-feature__media > i { position: absolute; inset: 0; display: grid; place-items: center; font-size: 48px; color: var(--line-strong); }
.post-feature__body { display: grid; gap: 12px; align-content: center; min-width: 0; }
.post-feature__title { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); line-height: 1.2; font-weight: 800; text-wrap: balance; transition: color var(--t-fast); }
.post-feature__title a { color: inherit; }
.post-feature__title a:hover { color: inherit; }
.post-feature__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--r-lg); }
.post-feature__title a:focus-visible { outline: none; }
.post-feature__title a:focus-visible::after { outline: 3px solid var(--blue); outline-offset: 6px; }
.post-feature:hover .post-feature__title { color: var(--blue-700); }
.post-feature__text { max-width: 52ch; font-size: 1.0625rem; line-height: 1.6; color: var(--muted); }
.post-feature .article-meta { margin-top: 4px; }
.post-feature__more { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 0.9375rem; font-weight: 700; color: var(--blue); }
.post-feature__more i { transition: transform var(--t-fast) var(--ease); }
.post-feature:hover .post-feature__more { color: var(--blue-700); }
.post-feature:hover .post-feature__more i { transform: translateX(3px); }

.blog-pager { margin-top: 48px; }

/* ---------- Article ---------- */
.article-head { max-width: 860px; padding: 8px 0 28px; }
.article-title { font-size: clamp(1.75rem, 1.25rem + 1.9vw, 2.75rem); line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
.article-lead { max-width: 62ch; margin-top: 14px; font-size: 1.1875rem; line-height: 1.55; color: var(--muted); }
.article-head .article-meta { margin-top: 20px; }
.article-cat { padding-block: 12px; margin-block: -12px; font-weight: 600; color: var(--blue); } /* 44px tall hit area, same line height */
.article-cat:hover { color: var(--blue-700); text-decoration: underline; text-underline-offset: 3px; }

/* Hero photo: the LCP image of the page (fetchpriority="high", never lazy) */
.article-hero { position: relative; margin: 0; aspect-ratio: 21 / 9; overflow: hidden; border-radius: var(--r-lg); background: var(--soft-2); }
.article-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Body + sticky aside (table of contents, call to action) */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: start; margin-top: 40px; }
.article-body { min-width: 0; }

/* Article text: readable measure, calm rhythm (Dertour-like typography) */
.article-prose { max-width: 72ch; font-size: 1.0625rem; line-height: 1.75; }
.article-prose > :first-child { margin-top: 0; }
.article-prose h2 { margin-top: 1.8em; font-size: clamp(1.375rem, 1.2rem + .6vw, 1.625rem); line-height: 1.25; }
.article-prose h3 { margin-top: 1.5em; font-size: 1.1875rem; line-height: 1.3; }
.article-prose h2 + *, .article-prose h3 + * { margin-top: .6em; }
.article-prose li::marker { color: var(--blue); }
.article-prose ol > li::marker { font-weight: 700; }
.article-prose figure { margin: 1.6em 0; }
.article-prose figcaption { margin-top: 8px; font-size: 0.875rem; color: var(--muted); }
.article-prose hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }

/* Tables inside articles (comparison tables): light, bordered, scroll sideways on phones */
.table-wrap { margin-block: 1.6em; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); scrollbar-width: thin; }
.table-wrap:focus-visible { outline-offset: 2px; border-radius: var(--r-md); }
.prose .table-wrap table, .compare { width: 100%; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
.prose .table-wrap th, .prose .table-wrap td, .compare th, .compare td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose .table-wrap tr:last-child > *, .compare tr:last-child > * { border-bottom: 0; }
.prose .table-wrap th, .compare th { background: var(--soft); color: var(--navy); font-weight: 700; }
.prose .table-wrap thead th, .compare thead th { font-size: 0.8125rem; white-space: nowrap; }
.prose .table-wrap td p, .prose .table-wrap th p { margin: 0; }
.prose .table-wrap td p + p, .prose .table-wrap th p + p { margin-top: .5em; }

/* Offers picked for the article */
.article-offers { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.article-offers__title { margin-bottom: 16px; font-size: 1.375rem; }
.inline-offers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* Aside: stays in view while reading */
.article-aside {
  position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 24px;
  max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 4px; margin: -4px; /* room for focus outlines inside the scroll box */
}

.toc h2 { margin-bottom: 10px; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; display: grid; border-left: 2px solid var(--line); }
.toc a {
  display: block; margin-left: -2px; padding: 7px 0 7px 14px; border-left: 2px solid transparent;
  font-size: 0.9375rem; line-height: 1.4; color: var(--text);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.toc a:hover { color: var(--blue); border-left-color: var(--blue); }
.toc a:focus-visible { outline-offset: 0; }

/* Call to action: light blue panel, green button (it leads to offers) */
.aside-cta { display: grid; gap: 8px; padding: 22px; border-radius: var(--r-lg); background: var(--blue-50); }
.aside-cta__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: var(--r-md); background: var(--white); color: var(--blue); font-size: 22px; }
.aside-cta h2 { font-size: 1.125rem; line-height: 1.3; }
.aside-cta p { font-size: 0.9375rem; line-height: 1.5; color: var(--muted); }
.aside-cta .btn { margin-top: 8px; }

/* Related articles at the end */
.article-related { padding-top: 40px; border-top: 1px solid var(--line); }
.article-related .section__head { align-items: center; }
.article-related .link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

/* ---------- Static pages (За нас, Как работи, Контакти, legal) ---------- */
.page-narrow { max-width: 760px; margin-inline: auto; }
.static-page { max-width: none; font-size: 1.0625rem; }
.static-page h2 { font-size: 1.375rem; line-height: 1.25; }
.static-page li::marker { color: var(--blue); }

/* "Как работи": numbered steps */
.prose .steps { list-style: none; display: grid; gap: 22px; padding-left: 0; counter-reset: step; }
.prose .steps > li { position: relative; min-height: 40px; margin-top: 0; padding-left: 58px; counter-increment: step; }
.prose .steps > li::before {
  content: counter(step); position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--blue-50); color: var(--blue-700); font-size: 1rem; font-weight: 800; line-height: 1;
}
.prose .steps > li > strong:first-child { display: block; margin-bottom: 2px; font-size: 1.0625rem; line-height: 1.4; }

/* "Контакти": e-mail as a quiet card */
.contact-mail { display: flex; width: fit-content; max-width: 100%; align-items: center; gap: 12px; min-height: 56px; padding: 10px 20px 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); }
.contact-mail i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--blue-50); color: var(--blue); font-size: 20px; flex: none; }
.prose .contact-mail a { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.prose .contact-mail a:hover { text-decoration: underline; }

/* ---------- Message states: 404, 419/500/503, unsubscribed ---------- */
.state { display: grid; justify-items: center; gap: 12px; max-width: 760px; margin: 56px auto 24px; text-align: center; }
.state__icon { display: grid; place-items: center; width: 88px; height: 88px; margin-bottom: 8px; border-radius: 50%; background: var(--blue-50); color: var(--blue); font-size: 44px; }
.state__icon svg { width: 44px; height: 44px; }
.state__code { font-size: 0.875rem; font-weight: 700; letter-spacing: 0.02em; color: var(--blue); }
.state__title { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); line-height: 1.15; font-weight: 800; text-wrap: balance; }
.state__text { max-width: 50ch; font-size: 1.0625rem; line-height: 1.6; color: var(--muted); }
.state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }

/* Search field (GET /oferti?q=…; with JS a click opens the header search with suggestions) */
.state__search { display: flex; gap: 8px; width: min(100%, 520px); margin-top: 12px; }
.state__field { position: relative; flex: 1 1 auto; min-width: 0; }
.state__field i { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); font-size: 20px; color: var(--blue); pointer-events: none; }
.state__field .input { padding-left: 46px; }
.state__search .btn { flex: none; min-height: 50px; }

/* Links to the main sections */
.state__nav { display: grid; justify-items: center; gap: 12px; margin-top: 20px; }
.state__label { font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.state__links { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Standalone error page (no layout): logo bar, centred message, small footer */
.error-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.error-page__main { flex: 1 0 auto; display: grid; align-items: center; padding-bottom: 32px; }
.error-page__foot { padding: 18px 0; border-top: 1px solid var(--line); background: var(--soft); font-size: 0.8125rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 40px; }
}
@media (max-width: 960px) {
  /* One column: table of contents first, then the text, then the call to action */
  .article-layout { display: flex; flex-direction: column; align-items: stretch; gap: 32px; margin-top: 28px; }
  .article-aside { display: contents; }
  .toc { order: -1; padding: 14px 18px 8px; border-radius: var(--r-md); background: var(--soft); }
  .toc ol { border-left: 0; }
  .toc li + li { border-top: 1px solid var(--line); }
  .toc a { display: flex; align-items: center; min-height: 44px; margin-left: 0; padding: 8px 0; border-left: 0; }
  .toc a:hover { border-left-color: transparent; }
}
@media (max-width: 900px) {
  .post-feature { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-bottom: 32px; padding-bottom: 32px; }
  .post-feature__text { font-size: 1rem; }
}
@media (max-width: 640px) {
  /* Category pills: one swipeable row, 44px touch targets */
  .blog-filters {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    margin: 0 calc(-1 * var(--gutter)) 24px; padding: 2px var(--gutter);
  }
  .blog-filters::-webkit-scrollbar { display: none; }
  .blog-filters .pill { flex: none; min-height: 44px; }
  .post-feature__media { border-radius: var(--r-md); }
  .blog-pager { margin-top: 36px; }

  .article-head { padding-bottom: 20px; }
  .article-lead { font-size: 1.0625rem; }
  .article-head .article-meta { margin-top: 16px; gap: 8px 14px; }
  .article-hero { aspect-ratio: 16 / 10; border-radius: var(--r-md); }
  .article-prose { font-size: 1rem; }
  .prose .table-wrap th, .prose .table-wrap td, .compare th, .compare td { padding: 10px 12px; }
  .article-offers { margin-top: 36px; padding-top: 28px; }
  .inline-offers { grid-template-columns: minmax(0, 1fr); }
  .aside-cta { padding: 20px 18px; }
  .article-related { padding-top: 32px; }

  .static-page { font-size: 1rem; }
  .prose .steps > li { padding-left: 52px; }

  .state { margin-top: 36px; }
  .state__icon { width: 76px; height: 76px; font-size: 38px; }
  .state__icon svg { width: 38px; height: 38px; }
  .state__text { font-size: 1rem; }
  .state__actions .btn { flex: 1 1 100%; }
  .state__search { flex-direction: column; }
  .state__search .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .post-feature:hover .post-feature__media img { transform: none; }
}
@media print {
  .article-aside, .article-related, .blog-filters, .state__search { display: none !important; }
  .article-layout { display: block; }
}
