/* Vacaylo blog. Load AFTER site.css (or legal.css); reuses their tokens (--bg, --card, --line, --lime, --on-lime, --forest, --ink, --muted).
   Logical properties only (RTL-safe). No external resources. */
:root {
  --blog-prose: #d4dfd0;      /* 11.6:1 on --bg, 10.5:1 on --card */
  --blog-glow: rgba(198, 239, 60, 0.28);
}

/* Neutralise site.css globals that would leak into blog markup */
.blog-hero, .blog-main, .article { padding-block-start: 0; }
.blog-main { padding-block: 0; }
.blog-main section { padding: 0; }

/* ---------- Index: hero ---------- */
.blog-hero { position: relative; overflow: hidden; padding: 64px 0 8px; text-align: center; }
.blog-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
  background:
    radial-gradient(560px 280px at 50% 0%, rgba(198, 239, 60, 0.13), transparent 70%),
    radial-gradient(480px 260px at 88% 40%, rgba(32, 73, 44, 0.6), transparent 70%),
    radial-gradient(480px 260px at 12% 50%, rgba(32, 73, 44, 0.5), transparent 70%);
}
.blog-hero > * { position: relative; }
.blog-hero h1 { font-size: clamp(34px, 5.4vw, 58px); line-height: 1.1; letter-spacing: -1.2px; font-weight: 900; margin: 18px auto 14px; max-width: 820px; text-wrap: balance; }
.blog-hero .lead, .blog-hero p { font-size: clamp(16px, 1.8vw, 19px); color: var(--muted); max-width: 620px; margin: 0 auto; }

/* ---------- Index: "All posts" + tag dropdown ----------
   Both reuse .lang-btn / .lang-list / .lang-check / .lang-chev from site.css (same look as the language menu).
   The dropdown is a native <details>, so it works without JavaScript. */
.blog-filters { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin: 32px 0 28px; }
.blog-filters .lang-btn { min-height: 44px; text-decoration: none; white-space: nowrap; }
.tag-all[aria-current="page"] { background: var(--lime); border-color: var(--lime); color: var(--on-lime); }
.tag-menu { position: relative; }
.tag-menu[open] { z-index: 30; }
.tag-btn { list-style: none; user-select: none; -webkit-user-select: none; }
.tag-btn::-webkit-details-marker { display: none; }
.tag-menu[open] > .tag-btn { border-color: var(--lime); }
.tag-menu[open] .lang-chev { transform: rotate(180deg); }
.tag-cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-menu .tag-list { position: absolute; top: calc(100% + 8px); inset-inline-start: 0; inset-inline-end: auto; min-width: 100%; width: max-content; max-width: min(320px, calc(100vw - 40px)); }
.tag-list li { padding: 0; }
.tag-list a { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 12px; border-radius: 12px; color: inherit; text-decoration: none; min-height: 40px; }
.tag-list .lang-name { overflow: hidden; text-overflow: ellipsis; }
.tag-list a:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; background: var(--lime); color: var(--on-lime); }
.tag-list a[aria-current="page"] .lang-check { visibility: visible; }
.tag-list a[aria-current="page"] { font-weight: 800; }

/* ---------- Index: grid + cards ---------- */
.blog-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 0 0 8px; padding: 0; list-style: none; }
@media (min-width: 640px) { .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1000px) { .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.post-card {
  display: flex; flex-direction: column; min-width: 0; height: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius, 22px); overflow: hidden;
  color: var(--ink); text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.post-card:hover, .post-card:focus-visible {
  transform: translateY(-4px); border-color: var(--lime);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45), 0 0 0 1px var(--blog-glow), 0 0 28px var(--blog-glow);
}
.post-card:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.post-card:active { transform: translateY(-1px); }

/* Media: gradient placeholder always sits underneath; a cover <img> paints over it. */
.post-card__media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; flex: none;
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(198, 239, 60, 0.30), transparent 60%),
    linear-gradient(135deg, #20492c 0%, var(--forest) 55%, var(--card) 100%);
}
.post-card__media::before {
  content: "\2708\FE0E"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 44px; color: rgba(198, 239, 60, 0.55); transform: rotate(-12deg);
}
.post-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.post-card:hover .post-card__media img { transform: scale(1.04); }

.post-card__body { display: flex; flex-direction: column; flex: 1; gap: 10px; padding: 20px 22px 22px; min-width: 0; }
.post-card__meta { margin: 0; font-size: 13px; line-height: 1.4; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.post-card__title { margin: 0; font-size: clamp(19px, 2vw, 22px); line-height: 1.25; font-weight: 800; letter-spacing: -.4px; color: var(--ink); overflow-wrap: anywhere; text-wrap: balance; }
.post-card:hover .post-card__title, .post-card:focus-visible .post-card__title { color: var(--lime); }
.post-card__excerpt {
  margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding: 6px 0 0; list-style: none; }
.post-card__tags > * {
  font-size: 12px; font-weight: 700; line-height: 1; padding: 6px 10px; border-radius: 999px;
  color: var(--lime); background: rgba(198, 239, 60, 0.10); border: 1px solid rgba(198, 239, 60, 0.25);
}

/* ---------- Empty state ---------- */
.blog-empty {
  max-width: 560px; margin: 24px auto 0; padding: 44px 28px; text-align: center;
  background: linear-gradient(135deg, var(--forest), var(--card)); border: 1px solid var(--line); border-radius: 28px;
}
.blog-empty::before { content: "\1F30D"; display: block; font-size: 56px; line-height: 1; margin-bottom: 16px; }
.blog-empty h2, .blog-empty h3 { font-size: clamp(22px, 3vw, 28px); letter-spacing: -.5px; margin: 0 0 8px; }
.blog-empty p { margin: 0; color: var(--muted); font-size: 16.5px; }

/* ---------- Article page ---------- */
.breadcrumb { max-width: calc(68ch + 40px); margin: 28px auto 0; padding-inline: 20px; font-size: 14px; color: var(--muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; list-style: none; }
.breadcrumb li { display: inline-flex; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.breadcrumb li + li::before { content: "/"; margin-inline: 10px; opacity: .6; }
.breadcrumb a { color: var(--muted); text-decoration: none; font-weight: 600; padding-block: 8px; }
.breadcrumb a:hover { color: var(--lime); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb [aria-current] { color: var(--ink); }

.article { max-width: calc(68ch + 40px); margin: 0 auto; padding: 20px 20px 0; overflow-wrap: break-word; }
/* <header> is position:sticky site-wide in site.css: reset it */
.article__header { position: static; z-index: auto; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 0; margin-bottom: 28px; }
.article__header h1 {
  font-size: clamp(30px, 5.2vw, 48px); line-height: 1.12; letter-spacing: -1px; font-weight: 900;
  margin: 0 0 16px; max-width: none; text-wrap: balance; overflow-wrap: anywhere;
}
.article__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 0; padding: 0; list-style: none; font-size: 14.5px; color: var(--muted); }
.article__meta a { color: var(--lime); text-underline-offset: 3px; }
.article__meta > * + *::before { content: "\00B7"; display: inline-block; text-decoration: none; margin-inline-end: 14px; opacity: .6; }
.article__cover { margin: 0 0 32px; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.article__cover img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
/* Cover may need a little extra width on desktop */
@media (min-width: 1000px) { .article__cover { margin-inline: -60px; } }

/* Prose */
.article__body { font-size: 18px; line-height: 1.7; color: var(--blog-prose); overflow-wrap: anywhere; word-break: normal; }
.article__body > :first-child { margin-block-start: 0; }
.article__body p { margin: 0 0 1.25em; font-size: inherit; }
.article__body h2, .article__body h3, .article__body h4 { color: var(--ink); font-weight: 800; scroll-margin-top: 90px; text-wrap: balance; }
.article__body h2 { font-size: clamp(25px, 3.4vw, 31px); line-height: 1.2; letter-spacing: -.6px; margin: 2.1em 0 .6em; padding-block-start: 1.1em; border-block-start: 1px solid var(--line); }
.article__body h2:first-child { border: 0; padding: 0; margin-block-start: 0; }
.article__body h3 { font-size: 22px; line-height: 1.3; letter-spacing: -.3px; margin: 1.8em 0 .5em; }
.article__body h4 { font-size: 18px; line-height: 1.4; margin: 1.5em 0 .4em; }
.article__body strong { color: var(--ink); font-weight: 700; }
.article__body em { font-style: italic; color: inherit; }
.article__body a { color: var(--lime); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: rgba(198, 239, 60, .55); transition: text-decoration-color .15s ease; }
.article__body a:hover { text-decoration-color: var(--lime); }
.article__body ul, .article__body ol { margin: 0 0 1.25em; padding-inline-start: 1.5em; }
.article__body li { margin-bottom: .5em; padding-inline-start: .2em; }
.article__body li > ul, .article__body li > ol { margin: .5em 0 0; }
.article__body li::marker { color: var(--lime); font-weight: 700; }
.article__body blockquote {
  margin: 1.8em 0; padding: 18px 22px; border-inline-start: 4px solid var(--lime);
  background: var(--card); border-radius: 4px 18px 18px 4px; color: var(--ink); font-size: 1.05em;
}
[dir="rtl"] .article__body blockquote { border-radius: 18px 4px 4px 18px; }
.article__body blockquote > :last-child { margin-bottom: 0; }
.article__body code {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}
.article__body pre {
  margin: 1.5em 0; padding: 16px 20px; overflow-x: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; font-size: 15px; line-height: 1.6; direction: ltr; text-align: left;
}
.article__body pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
.article__body hr { border: 0; height: 1px; background: var(--line); margin: 2.6em 0; }
.article__body img { display: block; max-width: 100%; height: auto; margin: 1.8em auto .5em; border-radius: 18px; border: 1px solid var(--line); }
/* Caption-like spacing: emphasised text directly after an image paragraph, or a figcaption */
.article__body figure { margin: 1.8em 0; }
.article__body figure img { margin-block: 0 .6em; }
.article__body figcaption, .article__body p > img + em { display: block; text-align: center; font-size: 14px; line-height: 1.5; color: var(--muted); font-style: normal; margin-block-end: 1.4em; }
/* Tables: Markdown emits a bare <table>; give it scroll behaviour (works without a wrapper) and neutralise site.css table rules */
.article__body table {
  display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-collapse: collapse; width: max-content; min-width: 100%; margin: 1.6em 0; font-size: 15.5px;
  border: 1px solid var(--line); border-radius: 14px;
}
.article__body th, .article__body td { width: auto; min-width: 10em; padding: 12px 16px; text-align: start; vertical-align: top; border: 1px solid var(--line); overflow-wrap: normal; }
.article__body th:not(:first-child), .article__body td:not(:first-child) { text-align: start; width: auto; }
.article__body th { background: var(--card); color: var(--ink); font-size: 13px; letter-spacing: .6px; text-transform: none; font-weight: 800; }
.article__body tr:last-child td { border-bottom: 1px solid var(--line); }
.article__body .table-wrap, .article__body .tablewrap { overflow-x: auto; margin: 1.6em 0; background: none; border-radius: 14px; }
.article__body .table-wrap table, .article__body .tablewrap table { margin: 0; display: table; }

.article__footer { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between; }
.article__footer a { color: var(--lime); text-underline-offset: 3px; }

/* Prev/next */
.article-nav { max-width: calc(68ch + 40px); margin: 36px auto 0; padding-inline: 20px; display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .article-nav { grid-template-columns: 1fr 1fr; max-width: 860px; } }
.article-nav a {
  display: flex; flex-direction: column; gap: 6px; min-height: 96px; justify-content: center; min-width: 0;
  padding: 18px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.article-nav a:hover, .article-nav a:focus-visible { transform: translateY(-3px); border-color: var(--lime); box-shadow: 0 0 24px var(--blog-glow); }
.article-nav a:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.article-nav small, .article-nav span:first-child { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--lime); }
.article-nav b, .article-nav strong { font-size: 17px; line-height: 1.3; font-weight: 800; }
.article-nav a[rel="next"] { text-align: end; }
/* A lone "next" card sits in the second column on desktop */
@media (min-width: 700px) { .article-nav a[rel="next"]:only-child { grid-column: 2; } }

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
  .blog-hero { padding: 44px 0 4px; }
  .blog-filters { margin: 24px 0 20px; }
  .tag-menu .tag-list { position: absolute; top: calc(100% + 8px); }
  .article__body { font-size: 17px; }
  .article__body h2 { font-size: 24px; }
  .article__body h3 { font-size: 20px; }
  .article__cover { border-radius: 18px; margin-inline: 0; }
  .breadcrumb { margin-top: 20px; }
  .blog-empty { padding: 34px 20px; border-radius: 22px; }
  .post-card__body { padding: 18px 18px 20px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .post-card, .article-nav a, .blog-filters .lang-btn, .post-card__media img { transition: none; }
  .post-card:hover, .post-card:focus-visible, .post-card:active,
  .article-nav a:hover, .article-nav a:focus-visible,
  .post-card:hover .post-card__media img { transform: none; }
}

/* ---------- Generator additions ---------- */
.post-card__more { margin-block-start: 6px; font-size: 14px; font-weight: 800; color: var(--lime); display: inline-flex; align-items: center; gap: 6px; }
.post-card__tags + .post-card__more, .post-card__excerpt + .post-card__more { margin-block-start: 10px; }
.post-card__more::after { content: "\2192"; display: inline-block; transition: transform .18s ease; }
[dir="rtl"] .post-card__more::after { content: "\2190"; }
.post-card:hover .post-card__more::after, .post-card:focus-visible .post-card__more::after { transform: translateX(4px); }
[dir="rtl"] .post-card:hover .post-card__more::after, [dir="rtl"] .post-card:focus-visible .post-card__more::after { transform: translateX(-4px); }

.reading-time { white-space: nowrap; }
.reading-time__n { font-variant-numeric: tabular-nums; font-weight: 700; }

/* Article tags: pills like the card tags, but interactive (the <a> is the pill) */
.article__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 6px 0 0; list-style: none; }
.article__tags > li { padding: 0; border: 0; background: none; border-radius: 0; line-height: 1; }
.article__tags a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--lime); text-decoration: none;
  background: rgba(198, 239, 60, 0.10); border: 1px solid rgba(198, 239, 60, 0.25);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.article__tags a:hover { background: var(--lime); border-color: var(--lime); color: var(--on-lime); }
.article__tags a:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.article__footer .article__tags { margin: 0; padding: 0; }

.article__back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink) !important; font-size: 14.5px; font-weight: 700; text-decoration: none !important;
  transition: border-color .15s ease, color .15s ease;
}
.article__back:hover { border-color: var(--lime); color: var(--lime) !important; }
.article__back:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
[dir="rtl"] .article__back [aria-hidden="true"] { display: inline-block; transform: scaleX(-1); }

/* Standalone image: <figure><img>…</figure> inside the body. The img rule already centres/rounds it. */
.article__body figure { margin: 1.8em 0; padding: 0; }
.article__body figure > img { margin: 0; width: auto; }
.article__body figure > img + figcaption { margin-block: .7em 0; }

@media (prefers-reduced-motion: reduce) {
  .post-card__more::after, .article__tags a, .article__back { transition: none; }
  .post-card:hover .post-card__more::after, .post-card:focus-visible .post-card__more::after,
  [dir="rtl"] .post-card:hover .post-card__more::after, [dir="rtl"] .post-card:focus-visible .post-card__more::after { transform: none; }
}
