/* =============================================================
   ARCHIVE NOTICIA — mobile first
   ============================================================= */

body.post-type-archive-noticia,
body.tax-news_type {
  --page-bg: var(--bg-3);
  --header-bg: var(--bg-3-50);
}

.noticia-archive {
  padding-bottom: 4rem;
}

/* ── Featured section ────────────────────────────────────────── */
.noticia-archive__featured {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 3rem;
  margin-bottom: 3rem;
}

/* ── Card ────────────────────────────────────────────────────── */
.noticia-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.noticia-card__image {
  display: block;
  overflow: hidden;
}

.noticia-card__image img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: opacity 0.2s;
}

.noticia-card__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.noticia-card__title a {
  text-decoration: none;
}

.noticia-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.noticia-card:hover .noticia-card__image img {
  opacity: 0.85;
}

.noticia-card:hover .noticia-card__title a {
  text-decoration: underline;
}

.noticia-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.noticia-card__body .btn-more {
  margin-top: auto;
}

/* ── Filter bar ──────────────────────────────────────────────── */
.noticia-archive__filter-bar {
  margin-bottom: 2.4rem;
}

.noticia-archive__filter-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--color-black);
}

.noticia-archive__filter-cell--title {
  flex: 1;
}

.noticia-archive__filter-cell--type {
  width: 150px;
  flex-shrink: 0;
}

.noticia-archive__filter-cell--date {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
}

/* Custom select */
.noticia-archive__select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.noticia-archive__select-wrap svg {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.noticia-archive__select {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding-right: 1.2rem;
  color: inherit;
  field-sizing: content;
  max-width: 200px;
}

.noticia-archive__select:focus {
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* Date sort link */
.noticia-archive__sort {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  width: 100%;
}

.noticia-archive__sort:hover {
  text-decoration: underline;
}

.noticia-archive__sort-icon {
  display: inline-flex;
}

.noticia-archive__sort.is-asc .noticia-archive__sort-icon svg {
  transform: rotate(180deg);
}

/* ── Table rows ──────────────────────────────────────────────── */
.noticia-archive__table {
  list-style: none;
  border-top: 1px solid var(--color-black);
}

.noticia-row {
  border-bottom: 1px solid var(--color-black);
}

.noticia-row__link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0;
  text-decoration: none;
  color: inherit;
}

.noticia-row__link:hover .noticia-row__title {
  text-decoration: underline;
}

.noticia-row__title {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.noticia-row__title .estudio-dot {
  align-self: flex-start;
  margin-top: 0.2em;
}

.noticia-row__type {
  width: 150px;
  flex-shrink: 0;
}

.noticia-row__date {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
  padding-right: calc(0.5rem + 12px);
}

/* ── Pagination ──────────────────────────────────────────────── */
.noticia-archive__pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 2rem 0 1rem;
}

.noticia-archive__page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding-inline: 0.5rem;
  text-decoration: none;
  border-radius: 999px;
  transition: background-color 0.2s;
}

.noticia-archive__page-link.is-active {
  background-color: var(--color-black);
  color: var(--bg-1);
}

.noticia-archive__page-link:hover:not(.is-active) {
  background-color: var(--color-warm-gray);
}

.noticia-archive__page-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
}

/* ── Empty state ─────────────────────────────────────────────── */
.noticia-archive__empty {
  padding: 2rem 0;
}

/* ── Estudio dot (shared across archive, home, single) ───────── */
.estudio-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}

/* ── Leyenda de estudios ─────────────────────────────────────── */
.estudios-leyenda {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem 1.5rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.estudios-leyenda__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* dot inside leyenda reuses .estudio-dot */

/* =============================================================
   TABLET  ≥ 640px
   ============================================================= */
@media (min-width: 640px) {
  .noticia-archive {
    padding-bottom: 5rem;
  }

  .noticia-archive__featured {
    grid-template-columns: 1fr 1fr;
  }

}

/* =============================================================
   DESKTOP  ≥ 1024px
   ============================================================= */
@media (min-width: 1024px) {
  .noticia-archive__featured {
    row-gap: 4rem;
  }

  .noticia-card {
    flex-direction: row;
    gap: 1.5rem;
  }

  .noticia-card__image {
    flex: 0 0 60%;
  }

  .noticia-archive__filter-cell--type,
  .noticia-archive__filter-cell--date,
  .noticia-row__type,
  .noticia-row__date {
    width: 20%;
  }
}

/* =============================================================
   MOBILE  max 639px  (table → stacked layout)
   ============================================================= */
@media (max-width: 639px) {
  /* Filter bar: three controls visible, each flexible */
  .noticia-archive__filter-cell--title {
    flex: 1;
  }

  .noticia-archive__filter-cell--type {
    flex: 1;
    width: auto;
  }

  .noticia-archive__filter-cell--date {
    width: auto;
  }

  /* Table rows: title full width, type+date on second line */
  .noticia-row__link {
    flex-wrap: wrap;
    gap: 0.2rem 1rem;
  }

  .noticia-row__title {
    width: 100%;
    flex: none;
  }

  .noticia-row__type {
    flex: 1;
    width: auto;
    padding-left: calc(10px + 0.5rem);
  }

  .noticia-row__date {
    width: auto;
  }
}
