/* =========================================================
   Publications (Archive + Single)
   Suporta Image Position: none | top | left | right | bottom
   ========================================================= */

/* Wrapper */
.bd-publications-archive,
.bd-page__content {
  max-width: var(--wp--style--global--content-size, 1260px);
  margin: 0 auto;
}

/* =========================================================
   Lista / Cards
   ========================================================= */

.bd-pub-item{
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* Base */
.bd-pub-item__inner{
  display: block;
  position: relative;
}

/* =========================================================
   Media (base)
   ========================================================= */

.bd-pub-item__media a{ display:block; }

/* IMPORTANTE: não forçar largura total para evitar "esticar" em top/bottom */
.bd-pub-item__media img{
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Conteúdo */
.bd-pub-item__content{
  min-width: 0;
}

/* =========================================================
   Título / Meta / Excerpt
   ========================================================= */

.bd-pub-item__title{
  margin: 0 0 .4rem 0;
  line-height: 1.25;
  font-weight: 600;
  color: var(--color-title);
}

.bd-pub-item__title a{
  color: inherit;
  text-decoration: none !important;
}

.bd-pub-item__title a:hover{
  text-decoration: none !important;
}

.bd-pub-item__meta{
  font-size: .95rem;
  opacity: .75;
  margin-bottom: .75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  color: var(--color-meta);
}

.bd-pub-item__sep{
  margin: 0 .15rem;
  opacity: .6;
}

.bd-pub-item__excerpt{
  font-size: 1rem;
  line-height: 1.6;
  color: var(--bd-logo-blue);
}

/* =========================================================
   Image Position: LEFT / RIGHT (texto envolve a imagem)
   ========================================================= */

/* limpar floats quando há left/right */
.bd-pub-item--img-left .bd-pub-item__inner::after,
.bd-pub-item--img-right .bd-pub-item__inner::after{
  content: "";
  display: block;
  clear: both;
}

.bd-pub-item--img-left .bd-pub-item__media,
.bd-pub-item--img-right .bd-pub-item__media{
  width: 220px;         /* ajusta 200–260px */
  max-width: 40%;
  margin-bottom: 1rem;
}

/* LEFT */
.bd-pub-item--img-left .bd-pub-item__media{
  float: left;
  margin: 0 1.5rem 1rem 0; /* topo alinhado com título */
}

/* RIGHT */
.bd-pub-item--img-right .bd-pub-item__media{
  float: right;
  margin: 0 0 1rem 1.5rem; /* topo alinhado com título */
}

/* =========================================================
   Image Position: TOP / BOTTOM
   - centrado
   - mantém dimensões (ou as definidas no WP)
   - BOTTOM funciona mesmo que o HTML venha antes (grid + order)
   ========================================================= */

.bd-pub-item--img-top .bd-pub-item__inner,
.bd-pub-item--img-bottom .bd-pub-item__inner{
  display: grid;
  grid-template-columns: 1fr;
  row-gap: 1rem;
}

/* garantir que não herda floats se o user trocar a opção */
.bd-pub-item--img-top .bd-pub-item__media,
.bd-pub-item--img-bottom .bd-pub-item__media{
  float: none;
  width: auto;
  max-width: 100%;
  margin: 0;
  justify-self: center;   /* centra o bloco media */
  text-align: center;
}

/* TOP: media primeiro */
.bd-pub-item--img-top .bd-pub-item__media{ order: 0; }
.bd-pub-item--img-top .bd-pub-item__content{ order: 1; }

/* BOTTOM: media depois */
.bd-pub-item--img-bottom .bd-pub-item__content{ order: 0; }
.bd-pub-item--img-bottom .bd-pub-item__media{ order: 1; }

/* em top/bottom: imagem não estica, respeita dimensões */
.bd-pub-item--img-top .bd-pub-item__media img,
.bd-pub-item--img-bottom .bd-pub-item__media img{
  width: auto;           /* <- chave para não “esticar” */
  max-width: 100%;
  height: auto;
  margin: 0 auto;        /* centra a imagem */
}

/* =========================================================
   Image Position: NONE
   ========================================================= */

.bd-pub-item--img-none .bd-pub-item__media{
  display: none;
}

/* =========================================================
   Paginação
   ========================================================= */

.bd-pub-pagination{
  margin-top: 2rem;
}

.bd-pub-pagination .page-numbers{
  display: inline-block;
  padding: .4rem .7rem;
  margin: 0 .15rem .25rem 0;
  text-decoration: none !important;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
  color: inherit;
  transition: all .2s ease;
}

.bd-pub-pagination .page-numbers:hover{
  border-color: rgba(0,0,0,0.25);
}

.bd-pub-pagination .page-numbers.current{
  font-weight: 600;
  border-color: rgba(0,0,0,0.35);
}

/* =========================================================
   Responsivo
   ========================================================= */

@media (max-width: 720px){
  /* Em mobile: left/right empilha */
  .bd-pub-item--img-left .bd-pub-item__media,
  .bd-pub-item--img-right .bd-pub-item__media{
    float: none;
    width: auto;
    max-width: 100%;
    margin: 0 0 1rem 0;
  }
}

/* =========================================================
   Single Publication
   ========================================================= */

body.single-publication .wp-block-post-title{
  color: var(--color-title);
  font-weight: 600;
}

body.single-publication .bd-pub-single__meta{
  font-size: .92rem;
  opacity: .75;
  margin-bottom: .75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  color: var(--color-meta);
}
