/* ============================================================================
   BPSO Blog — blog.css
   Design system "BPSO Lab 2026". All blog styles live here.
   Dark is default; [data-theme="light"] on <html> overrides.
   Language visibility is driven by [data-lang] on <html> + .lang-block.
   ========================================================================== */

/* ---------------------------------------------------------------- Tokens */
:root {
  --brand-blue: #2563eb;
  --brand-dark: #1e40af;
  --brand-light: #60a5fa;
  --brand-glow: rgba(37, 99, 235, .35);

  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, .08);

  /* category accents */
  --cat-security: #ef4444;
  --cat-dev: #2563eb;
  --cat-tools: #8b5cf6;

  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --measure: 70ch;
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --topbar-h: 64px;

  --bg-page: var(--bg-dark);
  --surface: var(--bg-card);
  --surface-2: #243349;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
}

/* Light theme overrides */
[data-theme="light"] {
  --bg-page: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border: rgba(15, 23, 42, .1);
  --brand-glow: rgba(37, 99, 235, .18);
  --shadow: 0 18px 40px -22px rgba(15, 23, 42, .25);
}

/* ------------------------------------------------------------- Base reset */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-main);
  background: var(--bg-page);
  /* Shared "Plotter Index" substrate: one calm brand glow + the cover's faint
     fiducial dot-grid, site-wide (subtle). Purple is reserved for the tools category. */
  background-image:
    radial-gradient(900px 500px at 85% -10%, var(--brand-glow), transparent 60%),
    radial-gradient(color-mix(in srgb, var(--text-muted) 9%, transparent) 1px, transparent 1.6px);
  background-size: 100% 100%, 30px 30px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(37, 99, 235, .1), transparent 60%),
    radial-gradient(color-mix(in srgb, var(--text-muted) 9%, transparent) 1px, transparent 1.6px);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--brand-light); text-decoration: none; }
[data-theme="light"] a { color: var(--brand-blue); }
/* ...but solid bg-colored button-links keep white text (else blue-on-blue vanishes) */
[data-theme="light"] .cta-btn { color: #fff; }

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.18; color: var(--text-main); }

:focus-visible {
  outline: 3px solid var(--brand-light);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--brand-blue);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ----------------------------------------------- Language visibility */
.lang-block { display: none; }
html[data-lang="pt"] .lang-block.lang-pt,
html[data-lang="en"] .lang-block.lang-en,
html[data-lang="es"] .lang-block.lang-es { display: inline; }

/* Block-level language wrappers (article bodies) */
html[data-lang="pt"] .lang-block.lang-pt.lang-flow,
html[data-lang="en"] .lang-block.lang-en.lang-flow,
html[data-lang="es"] .lang-block.lang-es.lang-flow { display: block; }

/* ----------------------------------------------------------- Top bar (floating pill) */
.topbar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, calc(100% - 2.5rem));
  z-index: 100;
  background: color-mix(in srgb, var(--bg-page) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.5);
}
@media (max-width: 768px) {
  .topbar { top: 10px; width: calc(100% - 1.4rem); }
}
[data-theme="light"] .topbar {
  background: rgba(248, 250, 252, 0.92);
  border-color: rgba(37, 99, 235, 0.14);
  box-shadow: 0 10px 28px -16px rgba(37, 99, 235, 0.2);
}

.topbar__inner {
  width: 100%;
  height: var(--topbar-h);
  padding: 0 clamp(1rem, 2.5vw, 1.8rem);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-main);
  letter-spacing: -.01em;
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.brand__dot { color: var(--brand-blue); }

/* Page-context tag (e.g. BLOG) beside BrunoP. */
.brand-tag {
  display: inline-block;
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--brand-light);
  background: rgba(37, 99, 235, 0.13);
  border: 1px solid rgba(37, 99, 235, 0.22);
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
[data-theme="light"] .brand-tag {
  color: var(--brand-blue);
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.25);
}

.topbar__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 600;
  font-size: .92rem;
  color: var(--text-muted);
  padding: .45rem .7rem;
  border-radius: var(--radius-sm);
  transition: color .18s, background .18s;
}
.backlink:hover { color: var(--text-main); background: var(--border); }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .03em;
  padding: .4rem .6rem;
  cursor: pointer;
  transition: color .18s, background .18s;
}
.lang-btn:hover { color: var(--text-main); }
.lang-btn.is-active { background: var(--brand-blue); color: #fff; }

/* Language dropdown (modelo SOBRE) */
.lang-switcher { position: relative; display: inline-flex; align-items: center; }
.lang-toggle-btn {
  appearance: none; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); height: 38px; padding: 0 12px; border-radius: 999px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-weight: 600; font-size: .8rem; letter-spacing: .03em;
  transition: color .18s, border-color .18s, background .18s;
}
.lang-toggle-btn:hover { color: var(--text-main); border-color: var(--brand-blue); }
.lang-toggle-btn .lang-chevron { font-size: .95rem; opacity: .65; transition: transform .25s ease; }
.lang-switcher.open .lang-chevron { transform: rotate(180deg); }
.lang-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 168px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35); z-index: 200;
  opacity: 0; transform: translateY(-8px) scale(.97); pointer-events: none;
  transition: opacity .2s ease, transform .2s cubic-bezier(.175, .885, .32, 1.275);
}
.lang-dropdown.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
[data-theme="light"] .lang-dropdown { box-shadow: 0 12px 35px rgba(148, 163, 184, .35); }
.lang-option {
  width: 100%; background: transparent; border: 0; color: var(--text-muted);
  padding: 10px 12px; border-radius: 9px; cursor: pointer; display: flex; align-items: center;
  gap: 10px; font-family: var(--font-body); font-weight: 500; font-size: .88rem;
  text-align: left; text-decoration: none; transition: color .18s, background .18s;
}
.lang-option:hover { background: color-mix(in srgb, var(--brand-blue) 10%, transparent); color: var(--text-main); }
.lang-option.is-active { background: color-mix(in srgb, var(--brand-blue) 14%, transparent); color: var(--brand-blue); font-weight: 700; }
.lang-option .lang-check { margin-left: auto; opacity: 0; color: var(--brand-blue); font-size: .9rem; }
.lang-option.is-active .lang-check { opacity: 1; }

.theme-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  transition: color .2s, transform .2s, border-color .2s, background .2s;
}
.theme-btn:hover { color: var(--brand-blue); border-color: var(--brand-blue); transform: rotate(15deg); }
[data-theme="light"] .theme-btn:hover { background: var(--brand-blue); color: #fff; }

/* sun/moon swap: show moon in dark mode, sun in light mode */
.theme-btn .ri-sun-line { display: none; }
.theme-btn .ri-moon-line { display: block; }
[data-theme="light"] .theme-btn .ri-sun-line { display: block; }
[data-theme="light"] .theme-btn .ri-moon-line { display: none; }

/* Reading progress — fixed strip at the very top of the viewport, independent of the pill */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 99;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-light));
  box-shadow: 0 0 10px var(--brand-glow);
  transition: width .08s linear;
}

/* ----------------------------------------------------------- Main / layout */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 5.5rem clamp(1rem, 4vw, 2rem) 4rem; /* 5.5rem clears the fixed pill navbar */
}

/* ----------------------------------------------------------- Blog hero */
.blog-hero {
  text-align: center;
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
  max-width: 740px;
}
.blog-hero__kicker {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .78rem;
  color: var(--brand-light);
  margin: 0 0 .8rem;
}
.blog-hero__title {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 800;
  margin: 0 0 1rem;
  letter-spacing: -.02em;
}
.blog-hero__title .amp { color: var(--brand-blue); }
.blog-hero__sub {
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  color: var(--text-muted);
  margin: 0;
}

/* ------------------------------------------------- Content-type filter pills */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
  margin: 0 auto clamp(1.6rem, 4vw, 2.4rem);
}
.blog-filter {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .82rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .5rem .95rem;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.blog-filter:hover { color: var(--text-main); border-color: color-mix(in srgb, var(--brand-blue) 50%, var(--border)); }
.blog-filter:focus-visible { outline: 2px solid var(--brand-light); outline-offset: 2px; } /* brand-light stays visible on the active (brand-blue) pill */
.blog-filter.is-active { color: #fff; background: var(--brand-blue); border-color: var(--brand-blue); }
.blog-filter__count {
  font-size: .72rem;
  font-weight: 700;
  padding: .05rem .42rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-muted) 18%, transparent);
  color: inherit;
}
.blog-filter.is-active .blog-filter__count { background: rgba(255, 255, 255, .25); }
/* cards filtered out by the active type */
.post-card.is-hidden { display: none; }
@media (prefers-reduced-motion: reduce) { .blog-filter { transition: none; } }

/* ----------------------------------------------------------- Post grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: clamp(1.2rem, 3vw, 1.8rem);
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  --card-pad: 1.6rem;
  padding: var(--card-pad);
  overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.post-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--cat-color, var(--brand-blue));
  opacity: .9;
  z-index: 3;             /* sit on top of the cover as the plot's binding edge */
}
.post-card:hover,
.post-card:focus-within {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 60%, var(--border));
  box-shadow: var(--shadow);
}

/* full-card click target without nesting interactive elements */
.post-card__link {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.post-card > :not(.post-card__link) { position: relative; z-index: 2; pointer-events: none; }

/* ===== Plotter Index cover system — bespoke covers that replace the emoji ===== */
/* One language: a fixed engineering substrate (dot grid + hairline frame + spec   */
/* stamp) + a per-post motif drawn ONLY from .pen/.ink/.field/.frame, varied by    */
/* the inherited --cat-color. Decorative (aria-hidden); the card link stays clickable. */
.post-card__cover {
  --cover-bg:   color-mix(in srgb, var(--cat-color, var(--brand-blue)) 6%,  var(--surface));
  --cover-grid: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 22%, transparent);
  --cover-fill: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 14%, transparent);
  position: relative;
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 0;   /* full-bleed top */
  height: 180px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  color: var(--cat-color, var(--brand-blue));            /* currentColor = the pen ink */
  background:
    radial-gradient(var(--cover-grid) 1px, transparent 1.5px) 0 0 / 24px 24px,
    var(--cover-bg);
}
.post-card__cover svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.post-card__cover .pen   { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.post-card__cover .ink   { fill: currentColor; stroke: none; }
.post-card__cover .field { fill: var(--cover-fill); stroke: none; }
.post-card__cover .frame { fill: none; stroke: var(--cover-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.post-card__cover .stamp { font: 600 9px/1 ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace; letter-spacing: .08em; fill: var(--text-muted); }
/* Light theme: keep the hue-tinted dots + fills visible on white (token-flip only). */
[data-theme="light"] .post-card__cover {
  --cover-grid: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 26%, transparent);
  --cover-fill: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 18%, transparent);
}
/* Post-header context: rounded panel, not full-bleed; larger on wide screens. */
.article__header .post-card__cover { margin: 0 0 1.6rem; border: 1px solid var(--border); border-radius: var(--radius); }
@media (min-width: 1280px) { .article__header .post-card__cover--lg { height: 240px; } }
@media (max-width: 480px)  { .post-card__cover { height: 150px; } }

/* --- Plotter draw-in: the covers "plot" themselves on first scroll-in — .pen strokes draw
   (stroke-dashoffset) and .ink/.field fills pop in. Gated by html.plot-anim, which blog.js
   adds ONLY when motion is allowed, so no-JS + reduced-motion users see covers fully drawn. */
html.plot-anim .post-card__cover .pen { stroke-dasharray: 1000; stroke-dashoffset: 1000; }
html.plot-anim .post-card__cover .ink,
html.plot-anim .post-card__cover .field { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.55); }
html.plot-anim .post-card__cover.is-drawn .pen { animation: plot-draw 1.2s cubic-bezier(.16, 1, .3, 1) forwards; }
html.plot-anim .post-card__cover.is-drawn .field { animation: plot-pop .5s ease .5s forwards; }
html.plot-anim .post-card__cover.is-drawn .ink { animation: plot-pop .5s ease .8s forwards; }
@keyframes plot-draw { to { stroke-dashoffset: 0; } }
@keyframes plot-pop { to { opacity: 1; transform: none; } }

.post-card__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: .5rem;
}
/* Content-TYPE label — neutral/outline pill (topic keeps the color via .post-card__cat). */
.post-card__type {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .7rem;            /* match the topic pill's box so the two sit even */
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .65rem;
  white-space: nowrap;
}
/* Light theme: a faint fill + firmer border so the neutral pill reads as a real object on white. */
[data-theme="light"] .post-card__type { background: var(--surface-2); border-color: rgba(15, 23, 42, .16); }

/* Screen-reader-only utility (used by the filter count labels + live status). */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.post-card__emoji {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .3));
}
.post-card__cat {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--cat-color, var(--brand-blue));
  background: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 16%, transparent);
  padding: .3rem .65rem;
  border-radius: 999px;
}

.post-card__title {
  font-size: 1.32rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.01em;
}
.post-card__excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: .96rem;
  line-height: 1.6;
}

.post-card__tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.post-card__tags li {
  font-size: .74rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .22rem .6rem;
}

.post-card__foot {
  margin-top: auto;
  padding-top: .4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.post-card__date { font-size: .82rem; color: var(--text-muted); }
.post-card__more {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .9rem;
  color: var(--cat-color, var(--brand-blue));
}
.post-card:hover .post-card__more i { transform: translateX(4px); }
.post-card__more i { transition: transform .2s; }

/* per-card view count + the "most read" marker (date · views on the left of the foot) */
.post-card__meta { display: inline-flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.post-card__views { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--text-muted); }
.post-card__views i { font-size: .95rem; opacity: .85; }
.post-card__hot {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--font-head); font-weight: 700; font-size: .66rem;
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
  color: #f59e0b;                                            /* warm "trending" accent, on-palette */
  border: 1px solid color-mix(in srgb, #f59e0b 38%, transparent);
  background: color-mix(in srgb, #f59e0b 13%, transparent);
  padding: .26rem .55rem; border-radius: 999px; margin-left: auto;
}
.post-card__hot i { font-size: .85rem; }

/* ----------------------------------------------- Finder-style instant search */
.blog-search { position: relative; max-width: 540px; margin: 0 auto clamp(1.4rem, 3.5vw, 2rem); }
.blog-search__icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.1rem; pointer-events: none; }
.blog-search__input {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: .98rem; color: var(--text-main);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: .85rem 2.7rem .85rem 2.8rem;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.blog-search__input::placeholder { color: var(--text-muted); }
.blog-search__input:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-blue) 18%, transparent); }
.blog-search__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.blog-search__clear {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-muted); font-size: 1.1rem; cursor: pointer;
  border-radius: 50%; transition: color .15s, background .15s;
}
.blog-search__clear:hover { color: var(--text-main); background: color-mix(in srgb, var(--text-muted) 14%, transparent); }

/* --------------------------------------------------------- "Destaque" hero */
.blog-featured {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 0;
  text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 clamp(1.6rem, 4vw, 2.4rem);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.blog-featured[hidden] { display: none; }
.blog-featured::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--cat-color, var(--brand-blue)); z-index: 3; }
.blog-featured:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 55%, var(--border)); box-shadow: var(--shadow); }
.blog-featured__media { position: relative; min-height: 100%; }
.blog-featured__media .post-card__cover { height: 100%; min-height: 250px; margin: 0; border: 0; border-right: 1px solid var(--border); border-radius: 0; }
.blog-featured__body { display: flex; flex-direction: column; gap: .85rem; padding: clamp(1.5rem, 3vw, 2.4rem); }
.blog-featured__kicker { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-head); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--cat-color, var(--brand-blue)); margin: 0; }
.blog-featured__title { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; letter-spacing: -.015em; line-height: 1.15; margin: 0; }
.blog-featured__excerpt { color: var(--text-muted); font-size: 1rem; line-height: 1.6; margin: 0; }
.blog-featured__foot { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: auto; padding-top: .4rem; font-size: .85rem; color: var(--text-muted); }
.blog-featured__cta { display: inline-flex; align-items: center; gap: .35rem; margin-left: auto; font-family: var(--font-head); font-weight: 600; color: var(--cat-color, var(--brand-blue)); }
.blog-featured__cta i { transition: transform .2s; }
.blog-featured:hover .blog-featured__cta i { transform: translateX(4px); }
@media (max-width: 720px) {
  .blog-featured { grid-template-columns: 1fr; }
  .blog-featured__media .post-card__cover { min-height: 170px; border-right: 0; border-bottom: 1px solid var(--border); }
}

/* ---------------------------------------------------------- Pagination */
.blog-empty { text-align: center; color: var(--text-muted); font-size: 1.05rem; padding: clamp(2rem, 6vw, 3.5rem) 1rem; }
.blog-pagination { display: flex; justify-content: center; align-items: center; gap: .4rem; flex-wrap: wrap; margin: clamp(2rem, 5vw, 3rem) 0 0; }
.blog-pagination[hidden] { display: none; }
.blog-page {
  min-width: 40px; height: 40px; padding: 0 .6rem;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 600; font-size: .9rem;
  color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.blog-page:hover:not(:disabled) { color: var(--text-main); border-color: color-mix(in srgb, var(--brand-blue) 50%, var(--border)); }
.blog-page.is-active { color: #fff; background: var(--brand-blue); border-color: var(--brand-blue); }
.blog-page:disabled { opacity: .4; cursor: default; }
.blog-page--nav { font-size: 1.15rem; }
@media (prefers-reduced-motion: reduce) { .blog-featured, .blog-search__input, .blog-page { transition: none; } }

/* ----------------------------------------------------------- Article layout */
.article {
  max-width: var(--measure);
  margin: 0 auto;
}
.article__header { margin-bottom: 2.4rem; }
.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.article__views { display: inline-flex; align-items: center; gap: .3rem; }
.article__views i { font-size: .95rem; opacity: .85; }

/* ----------------------------------------------- "Continue lendo" (related) */
.related { max-width: var(--measure); margin: clamp(3rem, 7vw, 4.5rem) auto 0; padding-top: clamp(2rem, 5vw, 3rem); border-top: 1px solid var(--border); }
.related__title { font-family: var(--font-head); font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 1.4rem; }
.related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2.5vw, 1.5rem); }
.related__card {
  position: relative; display: flex; flex-direction: column; gap: .7rem;
  text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  --card-pad: 1rem; padding: var(--card-pad); overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.related__card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--cat-color, var(--brand-blue)); z-index: 3; }
.related__card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 55%, var(--border)); box-shadow: var(--shadow); }
.related__card .post-card__cover { height: 120px; margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 0; }
.related__type {
  font-family: var(--font-head); font-weight: 600; font-size: .66rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: .24rem .55rem; align-self: flex-start;
}
.related__card-title { font-size: 1rem; font-weight: 700; line-height: 1.35; margin: 0; letter-spacing: -.01em; }
@media (max-width: 720px) { .related__grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .related__card { transition: none; } }
.article__cat {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--cat-color, var(--brand-blue));
  background: color-mix(in srgb, var(--cat-color, var(--brand-blue)) 16%, transparent);
  padding: .3rem .65rem;
  border-radius: 999px;
}
.article__title {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 .8rem;
}
.article__lead {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  margin: 0;
}

.article__body { font-size: 1.075rem; }
.article__body p { margin: 0 0 1.35rem; }
.article__body h2 {
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
  font-weight: 700;
  margin: 2.6rem 0 1rem;
  letter-spacing: -.01em;
}
.article__body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 .8rem;
}
.article__body ul,
.article__body ol { margin: 0 0 1.35rem; padding-left: 1.4rem; }
.article__body li { margin: .35rem 0; }
.article__body a { text-decoration: underline; text-underline-offset: 3px; }
.article__body strong { color: var(--text-main); font-weight: 600; }

.article__body blockquote {
  margin: 1.8rem 0;
  padding: .9rem 1.4rem;
  border-left: 4px solid var(--brand-blue);
  background: color-mix(in srgb, var(--brand-blue) 8%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-main);
  font-size: 1.08rem;
}
.article__body blockquote p:last-child { margin-bottom: 0; }

.article__body code {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
  font-size: .9em;
  background: color-mix(in srgb, var(--brand-blue) 14%, var(--surface));
  border: 1px solid var(--border);
  padding: .12em .4em;
  border-radius: 6px;
}
.article__body pre {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  margin: 0 0 1.6rem;
  font-size: .92rem;
  line-height: 1.55;
}
[data-theme="light"] .article__body pre { background: #0f172a; color: #e2e8f0; }
.article__body pre code {
  background: none;
  border: 0;
  padding: 0;
  color: #e2e8f0;
}

/* Answer capsule — 40-60 word direct answer at top of article (GEO/AI extraction) */
.article__capsule {
  font-size: 1.12rem;
  line-height: 1.7;
  margin: 0 0 2.4rem;
  padding: 1.1rem 1.5rem;
  border-left: 4px solid var(--brand-blue);
  background: color-mix(in srgb, var(--brand-blue) 7%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-main);
  font-weight: 450;
}

.article__figure { margin: 2rem 0; }
.article__figure figcaption {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: .6rem;
}

/* ------------------------------------------- Interactive container (posts) */
/* Posts mount their app inside .interactive; it can break out wider than the
   reading measure for a more immersive playground feel. */
.interactive {
  margin: 2.8rem auto;
  width: min(100%, 960px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.interactive__head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.interactive__head .dot { width: 11px; height: 11px; border-radius: 50%; }
.interactive__head .dot--r { background: #ef4444; }
.interactive__head .dot--y { background: #eab308; }
.interactive__head .dot--g { background: #22c55e; }
.interactive__title {
  margin-left: .4rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-muted);
}
.interactive__body { padding: clamp(1rem, 4vw, 1.8rem); }
.interactive__note {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
  margin: .8rem 0 0;
}

/* Controls legend below an interactive */
.interactive__legend {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem 1.1rem;
}
.interactive__legend li {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-muted);
}
kbd {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
  font-size: .8rem;
  line-height: 1;
  color: var(--text-main);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: .25em .5em;
  white-space: nowrap;
}

/* Inline CTA inside an article body */
.article__cta-wrap {
  margin: 2.4rem 0 0;
  text-align: center;
}

/* ----------------------------------------------------------- Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-page) 85%, #000 4%);
}
.site-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.4rem, 6vw, 4rem) clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}
.site-footer__cta { display: grid; gap: 1.2rem; justify-items: center; }
.site-footer__cta-line {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  max-width: 560px;
  color: var(--text-main);
}
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  background: var(--brand-blue);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.02rem;
  padding: .85rem 1.7rem;
  border-radius: 999px;
  box-shadow: 0 10px 30px -8px var(--brand-glow);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.cta-btn:hover {
  background: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 16px 38px -10px var(--brand-glow);
  color: #fff;
}
.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: .9rem;
  color: var(--text-muted);
}
.site-footer__meta p { margin: 0; }
.footer-back { color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
.footer-back:hover { color: var(--brand-light); }

/* ----------------------------------------------------------- Responsive */
@media (max-width: 768px) {
  .post-grid { grid-template-columns: 1fr; }
  /* Modelo SOBRE no mobile: marca + tag à esquerda; idioma (dropdown compacto) + tema à direita.
     O backlink sai no mobile — a marca já leva à home e o "Continue lendo" cobre o resto. */
  .topbar__inner { padding: 0 .8rem; gap: .5rem; }
  .topbar__nav { gap: .5rem; }
  .brand { font-size: 1.08rem; }
  .backlink { display: none; }
  .lang-toggle-btn { padding: 0 10px; height: 38px; }
  .lang-toggle-btn .lang-chevron { display: none; }
}

@media (max-width: 480px) {
  .blog-hero__title { font-size: clamp(1.8rem, 9vw, 2.4rem); }
  .post-card { --card-pad: 1.3rem; padding: var(--card-pad); }
}

@media (max-width: 360px) {
  .topbar__inner { gap: .5rem; padding: 0 .7rem; }
  .brand { font-size: 1.1rem; }
  .lang-btn { padding: .4rem .45rem; }
}

@media (min-width: 1280px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ----------------------------------------------------------- Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
