:root {
  --gray: #1a1a1a;
  --gray-soft: #e5e5e5;
  --gray-muted: #494949;
  --bg: #fcfcfc;
}

* {
  font-family: "Times New Roman", Times, serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--gray);
  text-decoration: none;
}

body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  background: var(--bg);
}

header{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

header img{
  height: 1.3rem;
  width: 1.3rem;
}

h1 {
  line-height: 1;
}

h1 span {
  font-size: 1.3rem;
  font-weight: 500;
}

/* Buscador */

.buscador {
  width: 100%;
}

.buscador input,
#textoBuscado {
  width: 100%;
  max-width: 40rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--gray-muted);
  border-radius: 4px;
  font-size: 1rem;
  background: white;
  box-shadow: 2px 2px 0 var(--gray);
}

.buscador input:focus,
#textoBuscado:focus {
  transition: all;
  transition-duration: 200ms;
  outline: 1px solid var(--gray-muted);
  box-shadow: 4px 4px 0 var(--gray);
}

/* Selector de periódicos */

.selector-periodicos {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.5rem;
}

.selector-periodicos li {
  flex: 0 0 auto;
}

.periodico-btn {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.55;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.periodico-btn.has-error img {
  border-color: #b00020;
}

.error-icon {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 1.15rem;
  height: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  line-height: 1;
  background: red;
  border-radius: 100%;
}

.periodico-btn:hover {
  transform: translateY(-4px);
}

.periodico-btn.is-selected {
  opacity: 1;
}

.selector-periodicos img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  object-position: center;
  border-radius: 100%;
  border: 1px solid var(--gray);
  background: white;
}

/* Noticias */

.seccion-noticias {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1rem;
}

.seccion-noticias article {
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid var(--gray);
  box-shadow: 2px 2px 0 var(--gray);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
  background: white;

}

.seccion-noticias article:hover {
  transition: all;
  transition-duration: 200ms;
  transform: translateX(-2px);
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--gray);
}

.seccion-noticias article > div {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.seccion-noticias article > div > div {
  display: flex;
  gap: 0.8rem;
}

.seccion-noticias article img {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  object-position: center;
  border-radius: 100%;
  border: 1px solid var(--gray);
  background: white;
  flex: 0 0 auto;
}

.seccion-noticias article h2 {
  font-size: 1.8rem;
  line-height: 1.15;
}

.seccion-noticias article h3 {
  font-size: 1.3rem;
  line-height: 1.1;
}

.seccion-noticias article small {
  color: var(--gray-muted);
}

.seccion-noticias article p {
  line-height: 1.35;
}

/* Loader e infinite scroll */

.loader {
  display: none;
  text-align: center;
  padding: 2rem 0;
  color: var(--gray-muted);
}

#sentinel {
  height: 1px;
}

/* Estados vacíos / errores opcionales */

.estado-vacio,
.error {
  border: 1px solid var(--gray);
  padding: 1rem;
}

.error {
  font-weight: bold;
}

/* Responsive */

@media (max-width: 600px) {
  body {
    padding: 0.75rem;
  }

  .selector-periodicos {
    gap: 0.75rem;
  }

  .selector-periodicos img,
  .seccion-noticias article img {
    width: 3rem;
    height: 3rem;
  }

  .seccion-noticias article {
    padding: 0.75rem;
  }

  .seccion-noticias article h1 {
    font-size: 1.15rem;
  }
}
