/* ============================================================
   Pixel Garden — sistema visual do Blog
   8-bit (blocos, sombra dura, fonte pixel) + line art orgânico
   Marca: cream / terra / forest / sage
   ============================================================ */
:root {
  --cream: #F4F0E6;
  --cream-light: #FBF9F2;
  --terra: #BF5A30;
  --terra-dark: #A24A26;
  --terra-light: #D4774F;
  --forest: #2E3A2F;
  --forest-light: #4A5A45;
  --sage: #8B9A75;
  --sage-soft: #E7EADD;
  --pixel: 'Press Start 2P', 'Courier New', monospace;
  --display: 'Playfair Display', Georgia, serif;
}

/* ---- Ícones pixel inline ---- */
.px-ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; image-rendering: pixelated; }

/* ---- Divisória de blocos (substitui a linha reta) ---- */
.pixel-divider {
  height: 8px; width: 100%; image-rendering: pixelated;
  background: repeating-linear-gradient(90deg,
    var(--terra) 0 8px, var(--terra-light) 8px 16px, var(--sage) 16px 24px);
}

/* ---- Vinha orgânica (line art) entre seções ---- */
.vine-divider { display: block; width: 100%; height: 24px; color: var(--sage); }

/* ---- Eyebrow em fonte pixel ---- */
.pg-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--pixel); font-size: 9px; line-height: 1.6;
  letter-spacing: .5px; text-transform: uppercase; color: var(--terra);
}

/* ============================================================
   Grade e cards do blog ("janela de jogo")
   ============================================================ */
.blog-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.blog-card {
  display: flex; flex-direction: column;
  background: #fff; border: 2px solid var(--forest);
  box-shadow: 4px 4px 0 rgba(46, 58, 47, .9);
  text-decoration: none; color: inherit;
  opacity: 0; transform: translateY(16px);
  transition: opacity .5s ease, transform .25s ease, box-shadow .15s ease;
}
.blog-card.is-visible { opacity: 1; transform: translateY(0); }
.blog-card:hover { transform: translate(-3px, -3px); box-shadow: 7px 7px 0 var(--terra); }

.blog-card__cover { height: 160px; overflow: hidden; border-bottom: 2px solid var(--forest); background: var(--cream-light); }
.blog-card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-card__cover--decor svg { display: block; width: 100%; height: 100%; }

.blog-card__body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.blog-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.blog-card__meta { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--sage); }
.blog-card__meta .px-ic { width: 13px; height: 13px; }
.blog-card__title { font-family: var(--display); font-size: 1.15rem; line-height: 1.25; color: var(--forest); margin: 0; }
.blog-card__excerpt { font-size: .875rem; color: var(--forest-light); line-height: 1.55; margin: 0; flex: 1; }
.blog-card__read { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 700; color: var(--terra); margin-top: 4px; }
.blog-card:hover .blog-card__read { color: var(--terra-dark); }
.blog-card__read .px-ic { transition: transform .2s; }
.blog-card:hover .blog-card__read .px-ic { transform: translateX(3px); }

/* ---- Tags pixel ---- */
.blog-tag {
  font-family: var(--pixel); font-size: 8px; line-height: 1; letter-spacing: .5px;
  text-transform: uppercase; padding: 6px 8px; border: 2px solid var(--forest);
  color: #fff; display: inline-block;
}
.tag--terra { background: var(--terra); }
.tag--forest { background: var(--forest-light); }
.tag--sage { background: var(--sage); }
.tag--clay { background: #9C6B4A; }
.tag--teal { background: #4E7C74; }
.tag--plum { background: #77556B; }
.tag--gold { background: #C08A2E; }
.tag--berry { background: #A64B57; }
.tag--ink { background: #2E3A2F; }

/* ============================================================
   Pilares (home) — cartões 8-bit com cor por categoria
   ============================================================ */
.pilar-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.pilar-card {
  --pc: var(--terra);
  display: flex; flex-direction: column; gap: 8px;
  background: #fff; border: 2px solid var(--forest);
  border-top: 6px solid var(--pc);
  box-shadow: 4px 4px 0 rgba(46, 58, 47, .9);
  padding: 18px; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.pilar-card:hover { transform: translate(-3px, -3px); box-shadow: 7px 7px 0 var(--pc); }
.pilar-card__ic {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--pc); background: color-mix(in srgb, var(--pc) 12%, #fff);
  border: 2px solid var(--forest); margin-bottom: 4px;
}
.pilar-card__ic svg { width: 22px; height: 22px; image-rendering: pixelated; }
.pilar-card__title { font-family: var(--display); font-size: 1.15rem; color: var(--forest); margin: 0; }
.pilar-card__desc { font-size: .85rem; color: var(--forest-light); line-height: 1.5; margin: 0; }

/* Moldura pixel da foto (sobre) */
.pilar-frame {
  display: inline-block; border: 3px solid var(--forest);
  box-shadow: 6px 6px 0 var(--terra); background: #fff; line-height: 0;
}

/* Barra de filtro por pilar (blog.html) */
.blog-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 1px; margin-bottom: 8px; }
.blog-filter__clear { font-size: .8rem; color: var(--forest-light); text-decoration: none; font-weight: 600; }
.blog-filter__clear:hover { color: var(--terra); }
.blog-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.blog-chip {
  font-family: var(--pixel); font-size: 8px; letter-spacing: .5px; text-transform: uppercase;
  padding: 8px 10px; border: 2px solid var(--forest); background: #fff; color: var(--forest);
  text-decoration: none; box-shadow: 2px 2px 0 rgba(46,58,47,.5); transition: transform .12s, box-shadow .12s;
}
.blog-chip:hover, .blog-chip.is-active { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--terra); background: var(--cream); }

/* ---- Card de destaque (home) ---- */
.blog-featured {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0;
  background: #fff; border: 2px solid var(--forest);
  box-shadow: 6px 6px 0 rgba(46, 58, 47, .9);
  text-decoration: none; color: inherit; margin-bottom: 24px;
  opacity: 0; transform: translateY(16px);
  transition: opacity .5s ease, transform .25s ease, box-shadow .15s ease;
}
.blog-featured.is-visible { opacity: 1; transform: translateY(0); }
.blog-featured:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--terra); }
.blog-featured__cover { border-right: 2px solid var(--forest); background: var(--cream-light); overflow: hidden; min-height: 240px; }
.blog-featured__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-featured__cover .blog-card__cover--decor { height: 100%; }
.blog-featured__body { padding: 28px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.blog-featured__badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--pixel); font-size: 8px; text-transform: uppercase; color: var(--terra); }
.blog-featured__title { font-family: var(--display); font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.15; color: var(--forest); margin: 0; }
.blog-featured__excerpt { font-size: .95rem; color: var(--forest-light); line-height: 1.6; margin: 0; }
#btn-surprise[disabled] { opacity: .5; cursor: default; pointer-events: none; }
@media (max-width: 720px) {
  .blog-featured { grid-template-columns: 1fr; }
  .blog-featured__cover { border-right: none; border-bottom: 2px solid var(--forest); min-height: 180px; }
  .blog-featured__body { padding: 20px; }
}

/* ---- Loader pixel ---- */
.pixel-loader { display: flex; gap: 6px; justify-content: center; padding: 60px 0; }
.pixel-loader span { width: 14px; height: 14px; background: var(--terra); animation: pg-bounce 1s infinite ease-in-out; }
.pixel-loader span:nth-child(2) { background: var(--terra-light); animation-delay: .15s; }
.pixel-loader span:nth-child(3) { background: var(--sage); animation-delay: .3s; }
@keyframes pg-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---- Vazio / erro ---- */
.blog-empty, .blog-error { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--forest-light); }
.blog-empty h2, .blog-error h2 { font-family: var(--display); color: var(--forest); margin-bottom: 8px; }
.blog-empty p, .blog-error p { margin-bottom: 16px; }
.blog-empty__icon { font-size: 40px; color: var(--sage); margin-bottom: 8px; }

/* ============================================================
   Botões pixel
   ============================================================ */
.pg-btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-weight: 700; font-size: .9rem; padding: 12px 20px;
  border: 2px solid var(--forest); background: var(--terra); color: #fff;
  box-shadow: 3px 3px 0 var(--forest); text-decoration: none; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.pg-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--forest); }
.pg-btn--light { background: #fff; color: var(--forest); }
.pg-btn--ghost { background: transparent; color: var(--forest); box-shadow: none; }
.pg-btn--ghost:hover { background: var(--cream); box-shadow: 3px 3px 0 var(--forest); }

/* ============================================================
   Post individual
   ============================================================ */
.post-wrap { max-width: 760px; }

.blog-breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8rem; color: var(--sage); margin-bottom: 24px; }
.blog-breadcrumb a { color: var(--forest-light); text-decoration: none; }
.blog-breadcrumb a:hover { color: var(--terra); }
.blog-breadcrumb .sep { color: var(--sage); }

.post-header { margin-bottom: 24px; }
.post-header .blog-tag { margin-bottom: 14px; }
.post-header h1 { font-family: var(--display); font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.12; color: var(--forest); margin: 0 0 12px; }
.post-date { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--sage); }

.post-cover { border: 2px solid var(--forest); box-shadow: 4px 4px 0 rgba(46, 58, 47, .9); margin-bottom: 28px; overflow: hidden; }
.post-cover img { width: 100%; display: block; }

.post-content { font-size: 1.05rem; line-height: 1.75; color: var(--forest-light); }
.post-content h2 { font-family: var(--display); color: var(--forest); font-size: 1.5rem; margin: 32px 0 12px; position: relative; padding-left: 18px; }
.post-content h2::before { content: ""; position: absolute; left: 0; top: 10px; width: 9px; height: 9px; background: var(--terra); }
.post-content h3 { font-family: var(--display); color: var(--forest); font-size: 1.2rem; margin: 24px 0 10px; }
.post-content p { margin: 0 0 18px; }
.post-content ul, .post-content ol { margin: 0 0 18px; padding-left: 2px; list-style: none; }
.post-content li { position: relative; padding-left: 24px; margin-bottom: 10px; }
.post-content li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 8px; height: 8px; background: var(--sage); }
.post-content a { color: var(--terra); text-decoration: underline; }
.post-content strong { color: var(--forest); font-weight: 700; }
.post-content blockquote { border-left: 4px solid var(--terra); background: var(--cream-light); padding: 14px 18px; margin: 18px 0; font-style: italic; color: var(--forest); }
.post-content img { max-width: 100%; height: auto; border: 2px solid var(--forest); }

.post-author { display: flex; gap: 16px; align-items: flex-start; background: var(--sage-soft); border: 2px solid var(--forest); box-shadow: 4px 4px 0 rgba(46, 58, 47, .9); padding: 20px; margin: 40px 0; }
.post-author__avatar { width: 64px; height: 64px; flex: none; border: 2px solid var(--forest); background: #fff; overflow: hidden; }
.post-author__avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-author__eyebrow { display: inline-flex; align-items: center; gap: 6px; font-family: var(--pixel); font-size: 8px; text-transform: uppercase; color: var(--terra); margin-bottom: 10px; }
.post-author__body h3 { font-family: var(--display); color: var(--forest); margin: 0 0 6px; }
.post-author__body p { font-size: .9rem; color: var(--forest-light); margin: 0 0 8px; line-height: 1.55; }
.post-author__link { display: inline-flex; align-items: center; gap: 6px; color: var(--terra); font-weight: 700; font-size: .85rem; text-decoration: none; }

.post-cta { background: var(--forest); border: 2px solid var(--forest); box-shadow: 5px 5px 0 var(--terra); padding: 32px; margin: 40px 0; text-align: center; color: var(--cream); }
.post-cta__eyebrow { display: inline-flex; align-items: center; gap: 6px; font-family: var(--pixel); font-size: 8px; text-transform: uppercase; color: var(--terra-light); margin-bottom: 12px; }
.post-cta h3 { font-family: var(--display); color: var(--cream); font-size: 1.4rem; margin: 0 0 10px; }
.post-cta__sub { color: rgba(244, 240, 230, .8); font-size: .95rem; margin: 0 0 20px; }
.post-cta__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.post-cta .pg-btn--ghost { color: var(--cream); border-color: var(--cream); }
.post-cta .pg-btn--ghost:hover { background: rgba(244, 240, 230, .12); box-shadow: 3px 3px 0 var(--terra); }

.post-back { display: inline-flex; align-items: center; gap: 8px; color: var(--forest-light); font-weight: 700; text-decoration: none; margin-top: 8px; }
.post-back .px-ic { transform: rotate(180deg); }
.post-back:hover { color: var(--terra); }

.post-related { margin-top: 48px; }
.post-related h2 { font-family: var(--display); color: var(--forest); font-size: 1.4rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

/* ============================================================
   Experiência de leitura (post.js) — Fase 2
   ============================================================ */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 60;
  background: transparent; pointer-events: none;
}
.reading-progress span {
  display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, var(--terra) 0 6px, var(--terra-light) 6px 12px);
  transition: width .1s linear;
}

/* Índice automático */
.post-toc {
  border: 2px solid var(--forest); background: var(--cream-light);
  box-shadow: 4px 4px 0 rgba(46, 58, 47, .9); padding: 16px 18px; margin: 0 0 28px;
}
.post-toc__title {
  font-family: var(--pixel); font-size: 8px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--terra); margin: 0 0 10px;
}
.post-toc ul { list-style: none; margin: 0; padding: 0; }
.post-toc li { position: relative; padding-left: 16px; margin-bottom: 7px; }
.post-toc li::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; background: var(--sage); }
.post-toc a { color: var(--forest-light); text-decoration: none; font-size: .9rem; line-height: 1.4; }
.post-toc a:hover { color: var(--terra); text-decoration: underline; }

/* Botões flutuantes */
.post-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 55;
  display: flex; flex-direction: column; gap: 10px;
}
.post-fab__btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--forest); background: #fff; color: var(--forest);
  box-shadow: 3px 3px 0 var(--forest); cursor: pointer; padding: 0;
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.post-fab__btn svg { width: 20px; height: 20px; image-rendering: pixelated; }
.post-fab__btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--terra); }
.post-fab__btn[data-share] { background: var(--terra); color: #fff; }
.post-fab__btn[data-top] { opacity: 0; pointer-events: none; }
.post-fab__btn[data-top].is-visible { opacity: 1; pointer-events: auto; }

/* Toast (link copiado) */
.post-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px);
  background: var(--forest); color: var(--cream); border: 2px solid var(--forest);
  box-shadow: 4px 4px 0 var(--terra); padding: 12px 18px; font-weight: 700; font-size: .85rem;
  z-index: 70; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
}
.post-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .post-cta { padding: 24px 18px; }
  .post-author { flex-direction: column; }
  .post-fab { right: 12px; bottom: 12px; }
}
