/* Category Cards — empilhados no mobile/tablet, lado a lado a partir de 1024px */

.cat-cards {
  position: relative;
  z-index: 4;
  background-color: var(--color-secondary);
  padding: clamp(1.5rem, 4lvh, 2.5rem) 8px var(--space-xl);
  overflow-anchor: none;
  isolation: isolate;
}

.cat-cards__inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

/* ── Card base ── */

@keyframes cat-card-enter {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cat-card-bg-enter {
  from {
    transform: scale(1.08);
    filter: blur(2px) brightness(0.42) saturate(1);
  }
  to {
    transform: scale(1.02);
    filter: blur(1px) brightness(0.52) saturate(1.1);
  }
}

@keyframes cat-card-item-enter {
  from {
    opacity: 0;
    visibility: hidden;
  }
  to {
    opacity: 1;
    visibility: visible;
  }
}

.cat-card {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  visibility: hidden;
  opacity: 0;
  transform: scale(0.97);
  contain: paint;
  transition: transform 280ms ease, box-shadow 280ms ease;
}

.cat-card.is-visible {
  visibility: visible;
}

.cat-card.is-visible:not(.is-enter-done) {
  animation: cat-card-enter 0.75s cubic-bezier(0.22, 1, 0.36, 1) var(--cat-reveal-delay, 0ms) both;
}

.cat-card.is-visible.is-enter-done {
  opacity: 1;
  transform: scale(1);
  contain: none;
}

.cat-card.is-enter-done.is-pressing {
  transform: scale(0.985);
  transition: transform 150ms ease;
}

/* ── Entrada em camadas (conteúdo interno) ── */

.cat-card.is-visible .cat-card__label,
.cat-card.is-visible .cat-card__pills,
.cat-card.is-visible .cat-card__phrase,
.cat-card.is-visible .cat-card__cta {
  opacity: 0;
  visibility: hidden;
}

.cat-card.is-visible:not(.is-enter-done) .cat-card__bg img {
  animation: cat-card-bg-enter 0.9s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--cat-reveal-delay, 0ms) + 60ms) both;
}

.cat-card.is-visible:not(.is-enter-done) .cat-card__label {
  animation: cat-card-item-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--cat-reveal-delay, 0ms) + 140ms) both;
}

.cat-card.is-visible:not(.is-enter-done) .cat-card__pills {
  animation: cat-card-item-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--cat-reveal-delay, 0ms) + 220ms) both;
}

.cat-card.is-visible:not(.is-enter-done) .cat-card__phrase {
  animation: cat-card-item-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--cat-reveal-delay, 0ms) + 300ms) both;
}

.cat-card.is-visible:not(.is-enter-done) .cat-card__cta {
  animation: cat-card-item-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--cat-reveal-delay, 0ms) + 380ms) both;
}

.cat-card.is-enter-done .cat-card__label,
.cat-card.is-enter-done .cat-card__pills,
.cat-card.is-enter-done .cat-card__phrase,
.cat-card.is-enter-done .cat-card__cta {
  opacity: 1;
  visibility: visible;
  transform: none;
  animation: none;
}

/* ── Fundo ── */

.cat-card__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.cat-card__bg img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(1px) brightness(0.52) saturate(1.1);
  transform: scale(1.02);
  transition: transform 520ms ease, filter 360ms ease;
}

/* ── Overlay ── */

.cat-card__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(10, 22, 15, 0.22) 0%, rgba(5, 12, 8, 0.6) 100%);
  pointer-events: none;
  transition: background 320ms ease, opacity 320ms ease;
}

/* ── Conteúdo interno ── */

.cat-card__content {
  position: relative;
  z-index: 2;
  padding: 22px 10px 54px;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  overflow: hidden;
}

.cat-card__top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Nome da categoria — destaque principal */
.cat-card__label {
  display: block;
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: var(--weight-title);
  letter-spacing: -0.03em;
  color: #faf7f2;
  line-height: 1.25;
}

/* ── Pills ── */

.cat-card__pills {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.cat-card__pills--rows {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.cat-card__pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Resuminho — colado no rodapé, acima do CTA */
.cat-card__phrase {
  margin: auto 0 8px;
  font-family: 'Montserrat', var(--font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: rgba(250, 247, 242, 0.72);
  text-wrap: pretty;
}

.cat-card__pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 100px;
  font-family: 'Montserrat', var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: rgba(250, 247, 242, 0.85);
  padding: 5px 11px;
  white-space: nowrap;
  line-height: 1.2;
  width: fit-content;
}

/* ── Botão "Ver detalhes" ── */

.cat-card__cta {
  position: absolute;
  bottom: 16px;
  right: 10px;
  left: 10px;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 100px;
  padding: 6px 8px;
  font-size: 12px;
  color: #faf7f2;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transition: transform 260ms ease, border-color 260ms ease, background-color 260ms ease;
}

/* ── Hover (desktop / cursor) ── */

@media (hover: hover) and (pointer: fine) {
  .cat-card:hover,
  .cat-card:focus-visible {
    transform: scale(1) translateY(-6px);
    box-shadow: 0 14px 30px rgba(8, 18, 12, 0.36);
  }

  .cat-card:hover .cat-card__bg img,
  .cat-card:focus-visible .cat-card__bg img {
    transform: scale(1.07);
    filter: blur(0.2px) brightness(0.62) saturate(1.15);
  }

  .cat-card:hover .cat-card__overlay,
  .cat-card:focus-visible .cat-card__overlay {
    background: linear-gradient(180deg, rgba(10, 22, 15, 0.16) 0%, rgba(5, 12, 8, 0.5) 100%);
  }

  .cat-card:hover .cat-card__cta,
  .cat-card:focus-visible .cat-card__cta {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.08);
  }
}

/* ── Focus visible ── */

.cat-card:focus-visible {
  outline: 2px solid rgba(250, 247, 242, 0.6);
  outline-offset: 3px;
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .cat-card,
  .cat-card.is-visible,
  .cat-card.is-enter-done,
  .cat-card.is-enter-done.is-pressing {
    transition: none;
    animation: none;
  }
  .cat-card__bg img,
  .cat-card__overlay,
  .cat-card__cta,
  .cat-card__label,
  .cat-card__pills,
  .cat-card__phrase {
    transition: none;
    animation: none;
  }
  .cat-card.is-visible,
  .cat-card.is-enter-done {
    visibility: visible;
    opacity: 1;
    transform: none;
    contain: none;
  }
  .cat-card.is-enter-done .cat-card__label,
  .cat-card.is-enter-done .cat-card__pills,
  .cat-card.is-enter-done .cat-card__phrase,
  .cat-card.is-enter-done .cat-card__cta {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
}

/* ── Mobile: legibilidade + altura intermediária ── */

@media (max-width: 767px) {
  .cat-cards {
    padding: clamp(1.5rem, 4lvh, 2.5rem) clamp(0.75rem, 3.5vw, 1.125rem) var(--space-xl);
  }

  .cat-cards__inner {
    gap: 14px;
    width: 98%;
    max-width: 24rem;
    margin-inline: auto;
  }

  .cat-card {
    width: 100%;
    aspect-ratio: 5 / 4;
    border-radius: 14px;
  }

  .cat-card__bg img {
    filter: blur(1px) brightness(0.48) saturate(1.1);
  }

  .cat-card__overlay {
    background: linear-gradient(180deg, rgba(10, 22, 15, 0.28) 0%, rgba(5, 12, 8, 0.68) 100%);
  }

  .cat-card__content {
    padding: 20px 16px 52px;
    gap: 11px;
  }

  .cat-card__label {
    font-size: 23px;
  }

  .cat-card__pills {
    margin-top: 9px;
    gap: 5px;
  }

  .cat-card__pill {
    font-size: 12.5px;
    font-weight: 500;
    padding: 5px 11px;
    color: rgba(250, 247, 242, 0.92);
  }

  .cat-card__phrase {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: rgba(250, 247, 242, 0.88);
    margin-bottom: 8px;
  }

  .cat-card__cta {
    bottom: 14px;
    left: 16px;
    right: 16px;
    font-weight: 500;
  }
}

/* ── Tablet / desktop ── */

@media (min-width: 480px) {
  .cat-cards {
    padding: clamp(1.75rem, 4lvh, 2.75rem) var(--section-padding-x) var(--space-2xl);
  }

  .cat-cards__inner {
    gap: 16px;
    max-width: min(1250px, 100%);
    margin: 0 auto;
  }

  .cat-card {
    border-radius: 1.25rem;
  }

  .cat-card__content {
    padding: 34px 20px 68px;
    gap: 16px;
  }

  .cat-card__label {
    font-size: 25px;
  }

  .cat-card__pills {
    margin-top: 12px;
    gap: 6px;
  }

  .cat-card__phrase {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .cat-card__pill {
    font-size: 13px;
    padding: 5px 12px;
  }

  .cat-card__cta {
    font-size: 12px;
    padding: 9px 14px;
    bottom: 24px;
    right: 18px;
    left: 18px;
  }
}

/* Tablet / iPad — empilhado; 3 colunas só a partir de desktop largo */
@media (min-width: 768px) {
  .cat-card {
    aspect-ratio: 16 / 10;
  }

  .cat-card__label {
    font-size: 33px;
  }

  .cat-card__phrase {
    font-size: 13px;
  }

  .cat-card__pill {
    font-size: 14px;
    padding: 6px 14px;
  }
}

@media (min-width: 1024px) {
  .cat-cards__inner {
    flex-direction: row;
    gap: 18px;
  }

  .cat-card {
    flex: 1 1 0;
    width: auto;
    aspect-ratio: 5 / 6.25;
  }

  .cat-card__label {
    font-size: 38px;
  }

  .cat-card__phrase {
    font-size: 14.5px;
  }

  .cat-card__pill {
    font-size: 15.5px;
    padding: 6px 16px;
  }

  .cat-card__content {
    padding: 44px 26px 82px;
    gap: 18px;
  }

  .cat-card__cta {
    font-size: 13px;
    bottom: 28px;
    right: 22px;
    left: 22px;
  }
}
