/* lysechko.com blog: language switch, listing cards, categories, article layout, table of contents.
   Loaded after site.css on blog pages and on both home pages (latest articles block).
   Same tokens and shape rules as site.css: pills for chips and buttons, cards 20px, media 12px. */

/* ---------- Language switch in the header ---------- */
.lang-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border: 1.5px solid var(--btn-line); border-radius: var(--radius-pill);
}
.lang-switch a {
  display: inline-grid; place-items: center; min-width: 40px; height: 34px; padding: 0 10px;
  border-radius: var(--radius-pill); font-size: .8125rem; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-2); text-decoration: none; transition: background-color .2s ease, color .2s ease;
}
.lang-switch a[aria-current] { background: var(--ink); color: var(--surface); }
.lang-switch a:not([aria-current]):hover { background: var(--bg-alt); color: var(--ink); }
.nav a[aria-current]::after { transform: scaleX(1); }
.nav a[aria-current] { color: var(--ink); }
@media (max-width: 359px) { .header-inner:has(.lang-switch) .brand span { display: none; } }

/* ---------- Blog hero and category chips ---------- */
.blog-hero { max-width: 900px; }
.blog-hero h1 { max-width: 22ch; }
.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.cat-nav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface);
  font-size: .9375rem; font-weight: 500; color: var(--ink); text-decoration: none;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.cat-nav a:hover { border-color: var(--accent); color: var(--accent); }
.cat-nav a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.cat-nav .count { font-size: .8125rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-nav a[aria-current] .count { color: var(--on-dark-muted); }

.blog-section { margin-top: clamp(36px, 5vw, 64px); }
.blog-section-title { margin-bottom: 20px; font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); letter-spacing: -.03em; }
.blog-section .post-featured + .post-grid { margin-top: 20px; }

/* ---------- Article cards ---------- */
.post-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.post-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  transition: border-color .2s ease, transform .3s var(--ease), box-shadow .3s ease;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-card); }
.post-card:focus-within { border-color: var(--accent); }
.post-card > img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--bg-alt); border-bottom: 1px solid var(--line); }
.post-card-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 18px 20px 20px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .8125rem; color: var(--muted); }
.post-cat {
  position: relative; z-index: 2; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); text-decoration: none;
}
.post-cat:hover { text-decoration: underline; text-underline-offset: 3px; }
.post-card h2, .post-card h3 { font-size: 1.1875rem; line-height: 1.28; letter-spacing: -.02em; }
.post-card h2 a, .post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h2 a::after, .post-card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.post-card h2 a:focus-visible, .post-card h3 a:focus-visible { outline: none; }
.post-card:has(h2 a:focus-visible), .post-card:has(h3 a:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
.post-excerpt { font-size: .9375rem; line-height: 1.55; color: var(--muted); }
.post-date { margin-top: auto; padding-top: 4px; font-size: .8125rem; color: var(--muted); }

.post-featured { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.post-featured > img { height: 100%; aspect-ratio: auto; min-height: 100%; border-bottom: 0; border-right: 1px solid var(--line); }
.post-featured .post-card-body { justify-content: center; gap: 14px; padding: clamp(22px, 3vw, 40px); }
.post-featured h3 { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.125rem); line-height: 1.12; letter-spacing: -.03em; }
.post-featured .post-excerpt { font-size: 1rem; }
@media (max-width: 799px) {
  .post-featured { grid-template-columns: 1fr; }
  .post-featured > img { aspect-ratio: 1200 / 630; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---------- Categories and topics ---------- */
.cat-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.cat-card { display: flex; flex-direction: column; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.cat-card h3 { font-size: 1.25rem; letter-spacing: -.02em; }
.cat-card h3 a { color: var(--ink); text-decoration: none; }
.cat-card h3 a:hover { color: var(--accent); }
.cat-card > p { margin-top: 8px; font-size: .9375rem; line-height: 1.55; color: var(--muted); }
.cat-card ul { display: grid; gap: 4px; margin-top: 14px; }
.cat-card li a {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-top: 1px solid var(--line); font-size: .9375rem; color: var(--ink-2); text-decoration: none;
}
.cat-card li a:hover { color: var(--accent); }
.cat-card .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-card-count { margin-top: auto; padding-top: 12px; font-size: .8125rem; font-weight: 600; color: var(--muted); }

.tag-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tag-list a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 14px;
  border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-hover);
  font-size: .875rem; font-weight: 600; text-decoration: none; transition: background-color .2s ease, color .2s ease;
}
.tag-list a:hover { background: var(--accent); color: var(--surface); }
.tag-list .count { font-weight: 500; opacity: .75; font-variant-numeric: tabular-nums; }
.tag-list .label, .share .label { font-size: .875rem; color: var(--muted); }

/* ---------- Article ---------- */
.article-hero { max-width: 900px; padding-bottom: clamp(18px, 2.5vw, 28px); }
.article-hero h1 { margin-top: 18px; font-size: clamp(2.125rem, 1.35rem + 3vw, 3.5rem); line-height: 1.05; letter-spacing: -.04em; }
.article-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.kicker-pill {
  display: inline-flex; align-items: center; min-height: 30px; padding: 5px 12px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-hover); font-size: .75rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; text-decoration: none;
}
.kicker-pill:hover { background: var(--accent); color: var(--surface); }
.kicker-sub { font-size: .875rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.kicker-sub::before { content: "›"; margin-right: 10px; color: var(--btn-line); }
.kicker-sub:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.article-byline { display: flex; align-items: center; gap: 12px; margin-top: 24px; }
.article-byline img { width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover; }
.article-byline p { display: flex; flex-direction: column; gap: 2px; font-size: .875rem; color: var(--muted); }
.article-byline a { color: inherit; text-decoration: none; }
.article-byline a b { color: var(--ink); font-weight: 600; }
.article-byline a:hover b { color: var(--accent); }
.byline-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.article-cover { margin-bottom: 20px; }
.article-cover img {
  width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 16px;
}

.article-grid { display: grid; gap: clamp(32px, 4vw, 56px); align-items: start; margin-top: clamp(8px, 2vw, 20px); }
@media (min-width: 1000px) { .article-grid { grid-template-columns: minmax(0, 1fr) 300px; } }
.article-main { min-width: 0; max-width: 760px; }
.article-main > .answer-box { margin-top: 0; max-width: none; }
.takeaways { margin-top: 16px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.takeaways h2 { font-size: .8125rem; letter-spacing: .07em; text-transform: uppercase; color: var(--ink); line-height: 1.3; }
.takeaways ul { display: grid; gap: 8px; margin-top: 12px; }
.takeaways li { position: relative; padding-left: 28px; color: var(--ink-2); line-height: 1.55; }
.takeaways li::before {
  content: ""; position: absolute; left: 3px; top: .5em; width: 14px; height: 8px;
  border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg);
}
.article-main .prose { margin-top: clamp(28px, 3vw, 40px); max-width: none; }
.article-main .prose > h2:first-child { margin-top: 0; }

/* table of contents: inline on small screens, sticky in the side column on large screens */
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.toc ol { display: grid; gap: 2px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid; grid-template-columns: 20px 1fr; gap: 6px; padding: 5px 8px; border-radius: 8px;
  font-size: .875rem; line-height: 1.35; color: var(--ink-2); text-decoration: none;
}
.toc a::before { content: counter(toc); font-size: .8125rem; font-weight: 700; color: var(--btn-line); font-variant-numeric: tabular-nums; }
.toc a:hover { background: var(--bg); color: var(--accent); }
.toc a.is-active { background: var(--accent-soft); color: var(--accent-hover); }
.toc a.is-active::before { color: var(--accent); }
.toc-inline { margin-top: 16px; padding: 4px 14px; }
.toc-inline summary { cursor: pointer; padding: 12px 4px; font-size: .8125rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink); }
.toc-inline ol { padding: 0 0 12px; }
.toc-side { padding: 16px 10px 10px; }
.toc-title { padding: 0 8px 8px; font-size: .8125rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink); }
.article-side { display: none; }
@media (min-width: 1000px) {
  .toc-inline { display: none; }
  .article-side {
    display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 16px);
    max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .article-side .aside-card { position: static; }
}

/* blocks inside the article body */
.prose .callout { border-left: 4px solid var(--accent); }
.prose .callout.warn { background: #FFF6E5; border-left-color: #C77700; }
.prose .template { padding: 16px 18px; background: var(--surface); border: 1.5px dashed var(--btn-line); border-radius: 14px; color: var(--ink); }
.prose .template p + p { margin-top: .5em; }
.prose .template-label { font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.prose ol.steps { list-style: none; padding-left: 0; display: grid; grid-template-columns: 1fr; gap: 14px; counter-reset: step; }
.prose ol.steps::before { content: none; display: none; }
.prose ol.steps > li { position: relative; padding-left: 46px; counter-increment: step; }
.prose ol.steps > li + li { margin-top: 0; }
.prose ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -1px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--surface); font-size: .875rem; font-weight: 700;
}
.prose blockquote { margin: 0; padding: 6px 0 6px 18px; border-left: 3px solid var(--accent); color: var(--ink); }
.prose .table-wrap { margin-top: 1.2em; }
.prose h2 { scroll-margin-top: calc(var(--header-h) + 16px); }

/* call to action at the end of every article */
.article-cta { margin-top: clamp(36px, 4vw, 52px); padding: clamp(24px, 3.5vw, 40px); border-radius: var(--radius-card); background: var(--dark); color: var(--on-dark); }
.article-cta .cta-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-dark); }
.article-cta h2 { margin-top: 10px; font-size: clamp(1.625rem, 1.25rem + 1.2vw, 2.25rem); letter-spacing: -.03em; color: var(--on-dark); }
.article-cta > p { margin-top: 12px; color: var(--on-dark-muted); max-width: 60ch; }
.article-cta ul { display: grid; gap: 8px; margin-top: 16px; }
.article-cta li { position: relative; padding-left: 28px; color: var(--on-dark); }
.article-cta li::before {
  content: ""; position: absolute; left: 3px; top: .5em; width: 14px; height: 8px;
  border-left: 2.5px solid var(--accent-on-dark); border-bottom: 2.5px solid var(--accent-on-dark); transform: rotate(-45deg);
}
.article-cta li b { color: var(--surface); }
.article-cta .cta-row { margin-top: 24px; }
.article-cta .note { margin-top: 16px; font-size: .875rem; color: var(--on-dark-muted); }
.article-cta .note a { color: inherit; text-underline-offset: 3px; }

.sources { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.sources h2 { font-size: 1.125rem; letter-spacing: -.01em; }
.sources ol { display: grid; gap: 6px; margin-top: 12px; padding-left: 1.4em; list-style: decimal; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.sources a { color: var(--ink-2); text-underline-offset: 3px; overflow-wrap: anywhere; }
.sources a:hover { color: var(--accent); }
.post-footer { display: grid; gap: 14px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share a, .share button {
  display: inline-flex; align-items: center; min-height: 34px; padding: 6px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .875rem; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: border-color .2s ease, color .2s ease;
}
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent); }

.more-list { display: grid; max-width: 860px; }
.more-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.more-list a { font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.35; }
.more-list a:hover { color: var(--accent); }
.more-list span { flex: none; font-size: .8125rem; color: var(--muted); }
.more-all { margin-top: 16px; }
.more-all a { font-weight: 600; color: var(--accent); text-decoration: none; }
.more-all a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* latest articles block on the home pages */
.home-blog-more { margin-top: 28px; }

@media print {
  .article-side, .toc-inline, .share, .article-cta .cta-row { display: none; }
}
