/**
 * Beta Energy — Blog (listing + article)
 * Tokens from css/variables.css. Layout reuses .container, .btn, header and footer.
 */

/* =========================================
   HERO (dark, deep green)
   ========================================= */
.blog-hero {
  background: var(--be-verde-profundo);
  color: var(--be-sobre-oscuro);
  padding: 64px 0;
}

.blog-hero h1 {
  color: var(--be-blanco);
  margin-bottom: 16px;
}

.blog-hero h1 em {
  font-style: normal;
  font-weight: 300;
  color: var(--be-lima);
}

.blog-hero .eyebrow {
  color: var(--be-lima);
}

.blog-hero p {
  font-size: 18px;
}

.blog-hero a:hover {
  color: var(--be-lima);
}

.blog-hero :focus-visible {
  outline-color: var(--be-lima);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 24px;
}

.breadcrumb li + li::before {
  content: '›';
  margin-right: 8px;
  opacity: .6;
}

.breadcrumb a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =========================================
   FILTERS
   ========================================= */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

/* Buttons grow so the row spans the full content width, like the card grid */
.blog-filters button {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--be-gris-300);
  border-radius: var(--be-radio-full);
  background: var(--be-blanco);
  color: var(--be-verde-profundo);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--be-transicion), border-color var(--be-transicion);
}

.blog-filters button:hover {
  background: var(--be-lima-100);
}

.blog-filters button[aria-pressed="true"] {
  background: var(--be-verde-profundo);
  border-color: var(--be-verde-profundo);
  color: var(--be-blanco);
}

/* Category colors: brand palette only (DESIGN.md). Each pair passes WCAG AA. */
.cat-ev      { --cat-bg: var(--be-lima);           --cat-fg: var(--be-verde-profundo); }
.cat-mercado { --cat-bg: var(--be-verde-profundo); --cat-fg: var(--be-blanco); }
.cat-legal   { --cat-bg: var(--be-negro);          --cat-fg: var(--be-lima); }
.cat-solar   { --cat-bg: var(--be-lima-100);       --cat-fg: var(--be-verde-profundo); }
.cat-bess    { --cat-bg: var(--be-blanco);         --cat-fg: var(--be-verde-profundo); }

.blog-filters button[class*="cat-"]::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--cat-bg);
  border: 1px solid var(--be-verde-profundo);
  vertical-align: 0;
}

.blog-filters button[class*="cat-"][aria-pressed="true"] {
  background: var(--cat-bg);
  border-color: var(--be-verde-profundo);
  color: var(--cat-fg);
}

/* =========================================
   SEARCH + DATE
   ========================================= */
.blog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: -16px 0 40px;
}

.blog-search {
  position: relative;
  flex: 1 1 360px;
}

.blog-search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 20px;
  height: 20px;
  translate: 0 -50%;
  color: var(--be-gris-600);
  pointer-events: none;
}

.blog-search input,
.blog-date select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--be-gris-300);
  border-radius: var(--be-radio-sm);
  background: var(--be-blanco);
  color: var(--be-tinta);
  font-size: 16px;
  transition: border-color var(--be-transicion), box-shadow var(--be-transicion);
}

.blog-search input {
  padding: 0 16px 0 48px;
}

.blog-search input::placeholder {
  color: var(--be-gris-600);
}

.blog-date {
  flex: 0 1 300px;
}

@media (max-width: 700px) {
  .blog-date {
    flex-basis: 100%;
  }
}

.blog-date select {
  padding: 0 16px;
  cursor: pointer;
}

.blog-search input:focus,
.blog-date select:focus {
  outline: none;
  border-color: var(--be-lima-700);
  box-shadow: 0 0 0 3px var(--be-lima-100);
}

.blog-empty {
  margin-top: 24px;
  padding: 32px;
  border: 1px dashed var(--be-gris-300);
  border-radius: var(--be-radio-md);
  color: var(--be-gris-600);
  text-align: center;
  max-width: none;
}

/* =========================================
   CARD GRID
   ========================================= */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--be-blanco);
  border: 1px solid var(--be-gris-300);
  border-radius: var(--be-radio-md);
  overflow: hidden;
  transition: box-shadow var(--be-transicion), border-color var(--be-transicion);
}

.post-card:hover {
  border-color: var(--be-lima);
  box-shadow: var(--be-sombra-md);
}

.post-card[hidden] {
  display: none;
}

.post-card-img {
  position: relative;
  overflow: hidden;
}

.post-card-img .post-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  box-shadow: var(--be-sombra-sm);
}

.post-card img {
  transition: scale 300ms ease-out;
}

.post-card:hover img {
  scale: 1.04;
}

.post-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  flex: 1;
}

.post-card h2,
.post-card h3 {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.3;
}

/* Whole card clickable through the title link */
.post-card {
  position: relative;
}

.post-card h2 a::after,
.post-card h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.post-card p {
  font-size: 15px;
  color: var(--be-gris-600);
}

.post-card .link-more {
  margin-top: auto;
  font-size: 15px;
  font-weight: 600;
  color: var(--be-verde-profundo);
}

/* Meta row: category badge · date · read time */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--be-gris-600);
}

.post-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--be-radio-sm);
  background: var(--cat-bg, var(--be-lima-100));
  color: var(--cat-fg, var(--be-verde-profundo));
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.blog-hero .post-meta {
  color: var(--be-sobre-oscuro);
}

/* =========================================
   ARTICLE
   ========================================= */
.article-hero-img {
  width: 100%;
  max-height: 480px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--be-radio-md);
  margin-bottom: 48px;
}

section.article {
  padding-top: 48px;
}

.article-body {
  max-width: 720px;
}

.article-body > * + * {
  margin-top: 20px;
}

.article-body h2 {
  font-size: clamp(24px, 3vw, 30px);
  margin-top: 48px;
}

.article-body ul {
  list-style: disc;
  padding-left: 24px;
}

.article-body li + li {
  margin-top: 8px;
}

.article-body a {
  color: var(--be-verde-profundo);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body .lead {
  font-size: 20px;
  line-height: 1.55;
  color: var(--be-verde-profundo);
}

.article-body .source {
  max-width: none;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--be-gris-300);
  font-size: 14px;
  color: var(--be-gris-600);
}

/* CTA box inside article */
.article-cta {
  margin-top: 48px;
  padding: 32px;
  border-radius: var(--be-radio-md);
  background: var(--be-lima-50);
  border: 1px solid var(--be-lima-100);
}

.article-cta h2 {
  margin-top: 0;
  font-size: 24px;
}

.article-cta p {
  margin: 12px 0 20px;
}

.article-cta .btn {
  text-decoration: none;
  color: var(--be-verde-profundo);
}

/* Related posts */
.related {
  background: var(--be-gris-100);
}

.related .section-head h2 {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .post-grid {
    grid-template-columns: 1fr;
  }

  .article-hero-img {
    margin-bottom: 32px;
  }

  .article-cta {
    padding: 24px;
  }
}

/* Dark-green badges need an edge on the deep green hero */
.blog-hero .post-badge {
  outline: 1px solid var(--be-lima);
}
