/* Blog stylesheet — server-rendered pages (api/routes/blog.js) can't run the
   React chrome, so this is a hand-ported subset of the real design system:
   same tokens/fonts/classes as src/index.css + src/chrome.css (source of
   truth — see DESIGN.md), trimmed to what a static content page needs. Kept
   as a stable, non-hashed file under public/ so Express can reference it by
   a fixed URL in both dev and prod without a build step. */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url('/fonts/bricolage-grotesque-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/atkinson-hyperlegible-next-variable.woff2') format('woff2');
}

:root {
  --field: oklch(0.975 0.004 275);
  --void: oklch(0.135 0.012 280);
  --void-2: oklch(0.225 0.014 280);
  --ink: oklch(0.17 0.012 275);
  --ink-2: oklch(0.38 0.014 275);
  --ink-3: oklch(0.49 0.014 275);
  --bone: oklch(0.965 0.005 275);
  --bone-2: oklch(0.8 0.01 275);
  --bone-3: oklch(0.68 0.012 275);
  --line: oklch(0.86 0.01 275);
  --line-d: oklch(0.32 0.015 280);
  --mint: oklch(0.86 0.15 165);
  --cyan: oklch(0.82 0.11 215);
  --blue: oklch(0.68 0.16 255);
  --violet: oklch(0.62 0.2 295);
  --magenta: oklch(0.7 0.22 335);
  --focus-on-field: oklch(0.5 0.2 265);
  --focus-on-void: oklch(0.82 0.11 215);

  --font-display: 'Bricolage Grotesque', 'Arial Narrow', system-ui, sans-serif;
  --font-ui: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-base: clamp(1.0625rem, 1.02rem + 0.18vw, 1.1875rem);
  --t-lg: clamp(1.25rem, 1.12rem + 0.55vw, 1.5rem);
  --t-xl: clamp(1.625rem, 1.3rem + 1.3vw, 2.25rem);
  --t-2xl: clamp(2.125rem, 1.55rem + 2.4vw, 3.5rem);
  --t-3xl: clamp(2.75rem, 1.7rem + 4.4vw, 5.5rem);

  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2rem;
  --s-5: 3rem;
  --s-6: 4rem;
  --gutter: clamp(1rem, 3vw, 2.5rem);
  --section-y: clamp(3.5rem, 8vw, 6.5rem);
  --container: 85rem;
  --measure: 62ch;
  --r-ctl: 10px;
}
@supports not (color: oklch(0 0 0)) {
  :root {
    --field: #f6f7f9; --void: #07080d; --void-2: #1a1b22;
    --ink: #0e0f15; --ink-2: #40424a; --ink-3: #5e6069;
    --bone: #f2f3f7; --bone-2: #bcbdc4; --bone-3: #9698a0;
    --line: #cfd1d8; --line-d: #31323b;
    --mint: #5bf0b8; --cyan: #63d6f1; --blue: #4c99f8; --violet: #9264ef; --magenta: #ec5cd3;
    --focus-on-field: #2955d3; --focus-on-void: #63d6f1;
  }
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--field);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus-on-field); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section-y { padding-block: var(--section-y); }


.t-h1 {
  font-family: var(--font-display); font-weight: 700; font-size: var(--t-3xl);
  line-height: 1.02; letter-spacing: -0.026em; margin: 0.5rem 0 0.75rem; text-wrap: balance;
}
.t-h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-xl); line-height: 1.1; letter-spacing: -0.018em; margin: 0 0 0.5rem; }
.t-lede { font-size: var(--t-lg); line-height: 1.45; color: var(--ink-2); max-width: 44ch; text-wrap: pretty; margin: 0 0 var(--s-5); }
.t-body { max-width: var(--measure); }
.t-body p { margin: 0 0 1.15em; color: var(--ink-2); }
.t-body ul { margin: 0 0 1.15em; padding-left: 1.25em; color: var(--ink-2); }
.t-body li { margin-bottom: 0.5em; }
.t-small { font-size: var(--t-sm); color: var(--ink-3); }


/* ── Post list: image-led grid, full width ───────────────────────────────── */
.blog-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--s-6) var(--s-4); }
@media (min-width: 40rem) { .blog-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .blog-list { grid-template-columns: repeat(3, 1fr); } }
.blog-item { display: flex; flex-direction: column; }
.blog-item .blog-cover { width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 14px; display: block; background: var(--void); }
.blog-item .blog-meta { margin-top: var(--s-3); }
.blog-item h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-lg); line-height: 1.2; margin: 0.3rem 0 0.4rem; letter-spacing: -0.012em; }
.blog-item h2 a { color: var(--ink); text-decoration: none; }
.blog-item h2 a:hover { text-decoration: underline; }
.blog-item p { margin: 0; color: var(--ink-2); font-size: var(--t-sm); }
.blog-meta { display: flex; gap: 0.5em; flex-wrap: wrap; }

/* Full-width banner on the post page itself. */
.blog-banner { width: 100%; height: auto; max-width: 40rem; aspect-ratio: 3 / 1; object-fit: cover; border-radius: 14px; display: block; margin-bottom: var(--s-4); background: var(--void); }
/* Cover text is real HTML laid over the image (responsive, selectable, never
   baked into the SVG): a soft scrim at the bottom keeps it legible on any cover. */
.cover-wrap { position: relative; display: block; border-radius: 14px; overflow: hidden; }
.cover-wrap::after { content: ''; position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(to top, rgba(7, 8, 13, 0.75), transparent); pointer-events: none; }
.cover-wrap img { display: block; }
.cover-label {
  position: absolute; z-index: 1; left: clamp(0.75rem, 4%, 1.5rem); bottom: clamp(0.6rem, 4%, 1.25rem);
  font: 700 clamp(0.8rem, 0.55rem + 1.1vw, 1.25rem) / 1.1 var(--font-display); letter-spacing: -0.005em;
  color: var(--bone); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.blog-banner-wrap { max-width: 40rem; margin-bottom: var(--s-4); }
.blog-banner-wrap .blog-banner { margin-bottom: 0; }
.chips--tabs { margin-bottom: var(--s-2); }
.chip--tab { font-weight: 700; }

.pagination { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.pagination a { font-weight: 600; text-decoration: none; }
.pagination a:hover { text-decoration: underline; }

/* ── Category filter chips + per-post tag ────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--s-5); }
.chip {
  display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 0.9rem;
  border: 1px solid var(--line); border-radius: 999px; font-size: var(--t-sm); font-weight: 600;
  color: var(--ink-2); text-decoration: none; transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}
.chip { gap: 0.5rem; }
.chip-count { font-size: var(--t-xs); font-variant-numeric: tabular-nums; opacity: 0.65; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip--active { background: var(--void); color: var(--bone); border-color: var(--void); }
.chip--active:hover { color: var(--bone); }

/* Category chips run to 50+ items (VTEX + Shopify combined) — a horizontal
   carousel instead of wrapping onto many lines. Nav buttons: public/site-chrome.js
   `[data-chips]`. The platform tabs (.chips--tabs, only 2-3 items) are untouched. */
.chips-scroll { display: flex; align-items: center; gap: 0.5rem; margin-bottom: var(--s-5); max-width: 100%; }
.chips-scroll .chips {
  flex: 1 1 auto; min-width: 0; /* the flexbox min-width:auto trap: without this, a flex item won't
  shrink below its unwrapped content's width, which pushed the whole page wider than the viewport
  on mobile instead of letting this row's own overflow-x scroll it internally. */
  flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  margin-bottom: 0; padding-block: 0.25rem;
  mask-image: linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);
}
.chips-scroll .chips::-webkit-scrollbar { display: none; }
.chips-scroll .chip { flex: none; scroll-snap-align: start; }
.chips-nav {
  flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--field); color: var(--ink);
  cursor: pointer; transition: border-color 160ms ease;
}
.chips-nav:hover { border-color: var(--ink-3); }
.chips-nav--prev svg { transform: scaleX(-1); }
/* Nothing to scroll (e.g. /artigos with 2 categories) — hide the buttons
   instead of just disabling them; a pair of dead arrow buttons next to a row
   that obviously already shows everything reads as a broken pager. */
.chips-nav[hidden] { display: none; }
.chips-nav:disabled { opacity: 0.35; cursor: default; }
.chips-nav:disabled:hover { border-color: var(--line); }

.tag {
  display: inline-flex; align-items: center; font-size: var(--t-xs); font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-3); text-decoration: none;
}
.tag:hover { color: var(--ink); text-decoration: underline; }

/* ── Related posts ────────────────────────────────────────────────────────── */
.blog-related { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.blog-related-list { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
@media (max-width: 40rem) { .blog-related-list { grid-template-columns: 1fr; } }
.blog-related-list a { text-decoration: none; color: var(--ink); display: block; }
.blog-related-list img { width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 0.5rem; }
.blog-related-list span { font-size: var(--t-sm); font-weight: 600; line-height: 1.3; display: block; }
.blog-related-list a:hover span { text-decoration: underline; }

/* ── Post CTA + source note ──────────────────────────────────────────────── */
.blog-cta { margin-top: var(--s-6); padding: var(--s-4) var(--gutter); border-radius: 16px; background: var(--void); color: var(--bone); text-align: center; }
.blog-cta p { margin: 0 0 var(--s-3); color: var(--bone-2); max-width: 44ch; margin-inline: auto; }
.blog-source { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--ink-3); }
.blog-source a { color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}

/* The fixed header (site-chrome.css) sits over the page top, so the content starts below it. */
.blog-main { padding-top: clamp(7rem, 14vw, 10rem); padding-bottom: clamp(3.5rem, 8vw, 6.5rem); }

/* ── Article body (Markdown → HTML, api/lib/markdown.js) ─────────────────── */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.15em; }
.prose p, .prose li { color: var(--ink-2); }
.prose h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-xl); line-height: 1.1; letter-spacing: -0.018em; margin: 2.2em 0 0.4em; color: var(--ink); scroll-margin-top: 6rem; }
.prose h3 { font-family: var(--font-display); font-weight: 700; font-size: var(--t-lg); line-height: 1.2; letter-spacing: -0.012em; margin: 1.8em 0 0.3em; color: var(--ink); scroll-margin-top: 6rem; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--ink-3); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose a { color: var(--ink); text-underline-offset: 0.2em; text-decoration-color: color-mix(in oklab, currentColor 35%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose figure { margin: 2em 0; }
.prose figure img { display: block; width: 100%; height: auto; border-radius: 14px; background: var(--void); }
.prose figcaption { margin-top: 0.5rem; font-size: var(--t-xs); color: var(--ink-3); }
.prose figcaption a { color: var(--ink-3); }
.prose .callout { border-left: 3px solid var(--void); padding: 0.25rem 0 0.25rem 1.1rem; }
.prose .callout p { margin: 0.4em 0; color: var(--ink); }
.read-more { margin-top: 0.25rem; font-size: var(--t-sm); }
.article-page { max-width: 62rem; }
