/**
 * descoberta.css — RevisaCursos
 * Tudo que ajuda a pessoa a achar o próximo conteúdo sem voltar pro Google:
 * breadcrumb, busca no cabeçalho, formulário/resultados de busca, chips de
 * categoria do 404 e bloco de mais lidos.
 *
 * Usa as variáveis de base.css (HSL sem wrapper) — nada de cor hardcoded.
 */

/* ---------------------------------------------------------------
 * Breadcrumb
 * ------------------------------------------------------------ */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: hsl(var(--muted-foreground));
}

.breadcrumb a {
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease;
}

.breadcrumb a:hover { color: hsl(var(--primary)); }

.breadcrumb__sep { color: hsl(var(--border)); }

.breadcrumb [aria-current="page"] {
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: hsl(var(--foreground));
}

@media (min-width: 640px) {
  .breadcrumb [aria-current="page"] { max-width: 46ch; }
}

/* ---------------------------------------------------------------
 * Busca no cabeçalho
 *
 * O botão de busca fica num wrapper junto do menu-toggle para o
 * .site-header__inner continuar com 3 filhos (logo | nav | ações) e o
 * space-between não se desmanchar.
 * ------------------------------------------------------------ */
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.search-toggle {
  display: grid;
  place-items: center;
  padding: 0.5rem;
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease, background 0.15s ease;
}

.search-toggle:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--secondary));
}

.site-search {
  display: none;
  border-top: 1px solid hsl(var(--border) / 0.6);
  background: hsl(var(--background));
  padding: 1rem 1.25rem;
}

.site-search.is-open { display: block; }

.site-search__inner {
  max-width: var(--container-max);
  margin: 0 auto;
}

/* ---------------------------------------------------------------
 * Formulário de busca (usado no header, no 404 e na página de resultados)
 * ------------------------------------------------------------ */
.search-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.search-form__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.625rem 0.875rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
}

.search-form__input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}

.search-form__submit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: none;
  border-radius: var(--radius-md);
  transition: opacity 0.15s ease;
}

.search-form__submit:hover { opacity: 0.9; }

/* No cabeçalho o botão vira só o ícone — não há largura para o rótulo. */
.site-search .search-form__submit span { display: none; }

@media (min-width: 640px) {
  .site-search .search-form__submit span { display: inline; }
}

.category-page__search {
  max-width: 34rem;
  margin: 1.5rem 0 2rem;
}

/* ---------------------------------------------------------------
 * 404: chips de categoria
 * ------------------------------------------------------------ */
.category-page--404 .category-page__desc { margin-bottom: 0; }

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.category-chips a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 9999px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.category-chips a:hover {
  color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

/* ---------------------------------------------------------------
 * Mais lidos — carrossel (v3.6)
 *
 * O scroll é do navegador (scroll-snap). As setas são atalho, não motor:
 * se o JS não rodar, o carrossel continua funcionando com o dedo.
 * ------------------------------------------------------------ */
.populares {
  margin-top: 3rem;
  padding: 1.5rem 0 1.5rem 1.5rem;   /* sem padding à direita: o card cortado
                                        na borda é o que diz "arrasta" */
  background: hsl(var(--secondary));
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.populares__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-right: 1.5rem;
  margin-bottom: 1rem;
}

.populares__title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1.0625rem;
  font-weight: 700;
}

.populares__arrows {
  display: flex;
  gap: 0.375rem;
  flex: 0 0 auto;
}

.populares__arrows[hidden] { display: none; }

.populares__arrow {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 9999px;
  transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.populares__arrow:hover:not(:disabled) {
  color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.populares__arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.populares__track {
  display: flex;
  gap: 0.875rem;
  margin: 0;
  padding: 0 1.5rem 0.25rem 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;              /* Firefox */
  -ms-overflow-style: none;
}

.populares__track::-webkit-scrollbar { display: none; }

.populares__track:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

.populares__item {
  flex: 0 0 13.5rem;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .populares__item { flex-basis: 15rem; }
}

.populares__card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.7);
  border-radius: var(--radius-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.populares__card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 20px -8px hsl(var(--brand-dark) / 0.18);
}

.populares__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: hsl(var(--muted));
}

.populares__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A numeração da lista antiga não some — vira selo sobre a capa. */
.populares__rank {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.375rem;
  font-family: "Sora", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: hsl(var(--brand-dark) / 0.8);
  backdrop-filter: blur(4px);
  border-radius: 9999px;
}

.populares__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.75rem 0.875rem 0.875rem;
}

.populares__cat {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.populares__name {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: hsl(var(--foreground));
  transition: color 0.15s ease;

  /* Três linhas no máximo: sem isso, um título longo estica só um card e o
     carrossel fica com os cartões de alturas diferentes. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.populares__card:hover .populares__name { color: hsl(var(--primary)); }

.populares__nota { margin-top: 0.15rem; }

@media (prefers-reduced-motion: reduce) {
  .populares__track { scroll-behavior: auto; }
  .populares__card:hover { transform: none; }
}
