/* Catálogo: cabeçalho compacto, grade de cards com mídia e leitura centrada. */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-shell > main:not(.list-app-page) { flex: 1 0 auto; }

.dx-home,
.dx-archive { padding-top: 0; }

/* Cabeçalho das páginas de arquivo e da home */
.dx-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px 56px;
  align-items: end;
  padding: clamp(28px, 4vw, 48px) 0 clamp(20px, 3vw, 30px);
}

.dx-head.has-search { grid-template-columns: minmax(0, 1.3fr) minmax(340px, 1fr); }
.dx-head h1 { font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.06; }
.dx-head h1 span { color: var(--blue-bright); }
.dx-head-copy > p { margin: 12px 0 0; color: var(--muted); font-size: clamp(1rem, 1.25vw, 1.1rem); line-height: 1.6; }
.dx-head-copy > p + p { margin-top: 8px; }
.dx-head-copy a { color: var(--blue-bright); text-decoration: underline; text-underline-offset: 3px; }

.dx-hero {
  padding-top: clamp(32px, 5vw, 64px);
  padding-bottom: clamp(28px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
}

.dx-hero h1 { font-size: clamp(2.1rem, 3.8vw, 3.4rem); }

.dx-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.dx-search:focus-within { border-color: var(--blue-bright); box-shadow: 0 0 0 3px rgb(56 168 255 / 0.18); }
.dx-search > span { color: var(--quiet); font-size: 1.3rem; line-height: 1; }

.dx-search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}

.dx-search input::placeholder { color: var(--quiet); }

.dx-search button {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out);
}

.dx-search button:hover { background: #1d4ed8; }

/* Categorias e contagem */
.dx-toolbar {
  display: flex;
  align-items: center;
  gap: 12px 24px;
  min-width: 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.dx-chips {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.dx-chips > a {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
}

.dx-chips > a:hover { border-color: var(--line-strong); background: var(--surface-raised); color: var(--ink); }
.dx-chips > a[aria-current="page"] { border-color: transparent; background: var(--blue); color: #fff; }
.dx-chips strong { color: var(--quiet); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.dx-chips > a[aria-current="page"] strong { color: rgb(255 255 255 / 0.82); }

.dx-count { flex: 0 0 auto; margin: 0; color: var(--quiet); font-size: 0.92rem; white-space: nowrap; }
.dx-count strong { color: var(--ink); font-family: "Hanken Grotesk", "Atkinson Hyperlegible", system-ui, sans-serif; font-size: 1.05rem; }

/* Seções */
.dx-section { margin-top: clamp(36px, 4vw, 52px); }
.dx-toolbar + .dx-section { margin-top: 28px; }

.dx-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 18px;
}

.dx-section-head h2 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); }
.dx-section-head p { margin: 6px 0 0; color: var(--muted); }

.dx-more {
  flex: 0 0 auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--blue-bright);
  font-weight: 800;
  white-space: nowrap;
}

.dx-more span { transition: transform 160ms var(--ease-out); }
.dx-more:hover span { transform: translateX(3px); }

/* Grade e card */
.dx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(17.5rem, 100%), 1fr));
  gap: 18px;
}

.dx-toolbar + .dx-grid,
.dx-head + .dx-grid { margin-top: 28px; }
.dx-grid.is-compact { grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); gap: 14px; }

.dx-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.dx-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.dx-card[hidden] { display: none; }

.dx-card > a {
  height: 100%;
  display: flex;
  flex-direction: column;
  color: inherit;
}

.dx-card > a:focus-visible { outline: 3px solid var(--blue-bright); outline-offset: -3px; border-radius: var(--radius); }

.dx-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  container-type: inline-size;
}

.dx-card-media > img,
.dx-card-media picture,
.dx-card-media picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dx-card-media .catalog-picture-wide { aspect-ratio: auto; height: 100%; }

.dx-card-media .catalog-picture-wide img {
  position: static;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  transform: none;
  object-position: 50% 0;
}

.dx-card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 18px;
}

.dx-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  margin: 0;
  overflow: hidden;
  color: var(--quiet);
  font-size: 0.8rem;
  font-weight: 700;
}

.dx-card-meta span { position: relative; }
.dx-card-meta span + span::before { content: "·"; position: absolute; left: -11px; }

.dx-card h2,
.dx-card h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  transition: color 160ms var(--ease-out);
}

.dx-card > a:hover h2,
.dx-card > a:hover h3 { color: var(--blue-bright); }

.dx-card-text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.dx-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 0; padding-top: 4px; }

.dx-card-tags span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: rgb(37 99 235 / 0.14);
  color: var(--blue-bright);
  font-size: 0.75rem;
  font-weight: 800;
}

/* Capa quando não há miniatura definida */
.dx-cover {
  --tint: 37 99 235;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 10%, rgb(var(--tint) / 0.3), transparent 56%),
    radial-gradient(circle at 90% 100%, rgb(var(--tint) / 0.16), transparent 52%),
    var(--surface-raised);
}

.dx-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(148 163 184 / 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgb(148 163 184 / 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at center, black 25%, transparent 80%);
}

.dx-cover.is-blue { --tint: 37 99 235; }
.dx-cover.is-teal { --tint: 20 184 166; }
.dx-cover.is-violet { --tint: 91 91 214; }
.dx-cover.is-amber { --tint: 217 119 6; }
.dx-cover.is-rose { --tint: 225 29 72; }
.dx-cover.is-sky { --tint: 56 168 255; }

.dx-cover-tokens {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: min(10px, 2.8cqi);
  padding: 0 12px;
}

.dx-cover-tokens .list-item-thumb {
  flex: 0 0 auto;
  width: min(54px, 15cqi);
  height: min(54px, 15cqi);
  border-radius: 14px;
  font-size: min(0.9rem, 4.2cqi);
  box-shadow: 0 8px 20px rgb(2 8 23 / 0.28);
}

.dx-cover-tokens .list-item-thumb.is-flag { font-size: min(1.9rem, 8.5cqi); }
.dx-cover-tokens .list-item-thumb.is-file { width: min(46px, 13cqi); height: min(56px, 16cqi); box-shadow: none; }

.dx-cover-mark {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(var(--tint) / 0.5);
  border-radius: 20px;
  background: rgb(var(--tint) / 0.18);
  color: var(--ink);
  font-family: "Hanken Grotesk", "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dx-cover-icon { position: relative; width: 56px; height: 66px; color: rgb(var(--tint)); }

html[data-theme="light"] .dx-cover-tokens .list-item-thumb { box-shadow: 0 6px 16px rgb(37 55 82 / 0.14); }

/* Texto de apoio abaixo da grade do catálogo de APIs */
.dx-archive > .directory-guide { margin-top: clamp(40px, 5vw, 64px); }

/* Leitura: artigos e páginas institucionais */
.text-page { width: min(calc(100% - 32px), 1120px); }
.text-page.blog-post { width: min(calc(100% - 32px), 54rem); }
.article-shell article { padding-block: clamp(24px, 4vw, 48px) clamp(32px, 5vw, 64px); }
.article-shell h1 { font-size: clamp(2.1rem, 4.2vw, 3.3rem); }
.article-shell a.button-primary { color: #fff; text-decoration: none; }
.page-prose section > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

@media (max-width: 960px) {
  .dx-head.has-search { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .dx-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .dx-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .dx-chips::-webkit-scrollbar { display: none; }
}

@media (max-width: 620px) {
  .dx-head { padding-top: 22px; }
  .dx-search { padding-left: 12px; }
  .dx-search button { padding: 0 14px; }
  .dx-grid { gap: 14px; }
  .text-page,
  .text-page.blog-post { width: min(calc(100% - 22px), 1120px); }
}
