/* Post cards shared by "Relacionados" (partials/related-footer.html) and category pages (_default/taxonomy.html).
   Linked right where the cards render so they never flash unstyled. */

/* ---------- Relacionados section ---------- */
.rel-section {
  max-width: var(--dica-shell, 1200px);
  margin: 12px auto 0;
  padding: 24px var(--dica-gutter, 24px) 36px;
  box-sizing: border-box;
}

.rel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.rel-head-ico .ff-hl-icon,
.rel-head-ico .ff-hl-icon svg {
  width: 44px;
  height: 44px;
  color: #1f6fe5;
  opacity: 1;
}

/* Pages without the destaques bar don't get its icon CSS, so set the fill here */
.rel-head-ico .ff-hl-icon {
  display: inline-flex;
}

.rel-head-ico .ff-hl-icon svg {
  display: block;
  max-width: none;
  fill: currentColor;
}

.rel-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.rel-title {
  margin: 0;
  color: #0f1b3d;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.4px;
}

.rel-lead {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 15.5px;
  line-height: 1.4;
}

.rel-all {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid #bcd3f7;
  border-radius: 999px;
  background: #fff;
  color: #1f6fe5 !important;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color .18s ease, border-color .18s ease;
}

.rel-all:hover {
  border-color: #1f6fe5;
  background: #eef4ff;
}

.rel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rel-grid li {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rel-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 10px 12px;
  border: 1px solid #edf1f7;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .05);
  box-sizing: border-box;
  color: inherit;
  text-decoration: none !important;
  transition: transform .18s ease, box-shadow .18s ease;
}

.rel-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .1);
}

.rel-thumb {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 8.2;
  border-radius: 10px;
  background: #eef2f7;
}

.rel-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

.rel-name {
  display: -webkit-box;
  margin: 12px 4px 6px;
  overflow: hidden;
  color: #0f1b3d;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rel-card:hover .rel-name {
  color: #1f6fe5;
}

.rel-desc {
  display: -webkit-box;
  margin: 0 4px;
  overflow: hidden;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: auto 4px 0;
  padding-top: 12px;
}

.rel-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #64748b;
  font-size: 13.5px;
}

.rel-date svg,
.rel-go svg {
  display: block;
  max-width: none;
}

.rel-go {
  display: inline-flex;
  color: #1f6fe5;
}

html[data-theme="dark"] .rel-title,
html[data-theme="dark"] .rel-name {
  color: var(--dica-ink);
}

html[data-theme="dark"] .rel-lead,
html[data-theme="dark"] .rel-desc,
html[data-theme="dark"] .rel-date {
  color: var(--dica-muted);
}

html[data-theme="dark"] .rel-card,
html[data-theme="dark"] .rel-all {
  border-color: var(--dica-border);
  background: var(--dica-surface-raised);
  box-shadow: none;
}

html[data-theme="dark"] .rel-all,
html[data-theme="dark"] .rel-go,
html[data-theme="dark"] .rel-head-ico .ff-hl-icon,
html[data-theme="dark"] .rel-card:hover .rel-name {
  color: var(--dica-action) !important;
}

@media (max-width: 1100px) {
  .rel-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .rel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .rel-head {
    flex-wrap: wrap;
  }

  .rel-all {
    order: 3;
  }
}

/* Phones: 2 compact columns, no description (Relacionados: first 6 only) */
@media (max-width: 560px) {
  .rel-section {
    padding: 18px 16px 28px;
  }

  .rel-head {
    gap: 12px;
  }

  .rel-head-ico .ff-hl-icon,
  .rel-head-ico .ff-hl-icon svg {
    width: 34px;
    height: 34px;
  }

  .rel-title {
    font-size: 22px;
  }

  .rel-lead {
    font-size: 14px;
  }

  .rel-grid {
    gap: 10px;
  }

  .rel-section .rel-grid li:nth-child(n+7) {
    display: none;
  }

  .rel-card {
    padding: 8px 8px 10px;
    border-radius: 14px;
  }

  .rel-name {
    margin: 10px 2px 0;
    font-size: 14px;
    -webkit-line-clamp: 3;
  }

  .rel-desc {
    display: none;
  }

  .rel-foot {
    margin: auto 2px 0;
    padding-top: 8px;
  }

  .rel-date {
    font-size: 12px;
  }
}

/* ---------- Categorias card (bottom of category pages) ---------- */
.catcard {
  --catcard-line: #e3eaf5;
  margin: 36px 0 0;
  padding: 22px 24px 12px;
  border: 1px solid #e3eaf5;
  border-radius: 18px;
  background: #f7faff;
}

.catcard-head {
  margin-bottom: 12px;
}

.catcard-ico {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #e2ecfc;
  color: #1f6fe5;
}

.catcard-ico .ff-hl-icon,
.catcard-ico .ff-hl-icon svg {
  display: block;
  width: 26px;
  height: 26px;
  max-width: none;
  fill: currentColor;
}

.rel-title.catcard-title {
  font-size: 24px;
}

/* 3 columns, rows read left to right; inset lines under items, rules between columns */
.catcard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.catcard-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 13px 20px 13px 16px;
  color: #0f1b3d !important;
  font-size: 15.5px;
  text-decoration: none !important;
}

.catcard-item::after {
  content: "";
  position: absolute;
  right: 20px;
  bottom: 0;
  left: 16px;
  height: 1px;
  background: var(--catcard-line);
}

.catcard-item:nth-child(3n+2),
.catcard-item:nth-child(3n+3) {
  border-left: 1px solid var(--catcard-line);
}

.catcard-item:nth-last-child(-n+3)::after {
  display: none;
}

.catcard-item-ico .ff-hl-icon {
  display: inline-flex;
}

.catcard-item-ico .ff-hl-icon svg {
  display: block;
  width: 22px;
  height: 22px;
  max-width: none;
  fill: currentColor;
}

.catcard-item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catcard-item-go {
  flex: none;
  color: #94a3b8;
  transition: transform .15s ease, color .15s ease;
}

.catcard-item:hover .catcard-item-name,
.catcard-item.is-current .catcard-item-name {
  color: #1f6fe5;
}

.catcard-item:hover .catcard-item-go {
  color: #1f6fe5;
  transform: translateX(2px);
}

.catcard-item.is-current {
  font-weight: 700;
}

.catcard-item.is-current .catcard-item-ico {
  color: #1f6fe5;
}

html[data-theme="dark"] .catcard {
  --catcard-line: var(--dica-border);
  border-color: var(--dica-border);
  background: var(--dica-surface-raised);
}

html[data-theme="dark"] .catcard-ico {
  background: var(--dica-action-soft);
  color: var(--dica-action);
}

html[data-theme="dark"] .catcard-item {
  color: var(--dica-ink) !important;
}

html[data-theme="dark"] .catcard-item:hover .catcard-item-name,
html[data-theme="dark"] .catcard-item.is-current .catcard-item-name,
html[data-theme="dark"] .catcard-item.is-current .catcard-item-ico {
  color: var(--dica-action);
}

/* 2 columns */
@media (max-width: 900px) {
  .catcard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catcard-item:nth-child(3n+2),
  .catcard-item:nth-child(3n+3) {
    border-left: 0;
  }

  .catcard-item:nth-child(2n) {
    border-left: 1px solid var(--catcard-line);
  }

  .catcard-item:nth-last-child(-n+3)::after {
    display: block;
  }

  .catcard-item:last-child::after {
    display: none;
  }
}

/* 1 column */
@media (max-width: 560px) {
  .catcard {
    padding: 18px 16px 8px;
  }

  .catcard-ico {
    width: 46px;
    height: 46px;
  }

  .rel-title.catcard-title {
    font-size: 21px;
  }

  .catcard-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .catcard-item:nth-child(2n) {
    border-left: 0;
  }

  .catcard-item {
    padding: 12px 8px;
  }

  .catcard-item::after {
    right: 8px;
    left: 8px;
  }
}

/* ---------- Category header card (top of category pages) ---------- */
.cat-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 196px;
  margin: 0 0 16px;
  padding: 30px 36px;
  overflow: hidden;
  border: 1px solid #edf1f7;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.cat-hero-ico {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 108px;
  height: 108px;
  border-radius: 26px;
  background: linear-gradient(135deg, #4f8ff7 0%, #1f6fe5 55%, #1a4fc0 100%);
  box-shadow: 0 14px 28px rgba(31, 111, 229, .3);
  color: #fff;
}

.cat-hero-ico .ff-hl-icon,
.cat-hero-ico .ff-hl-icon svg {
  display: block;
  width: 50px;
  height: 50px;
  max-width: none;
  fill: currentColor;
}

.cat-hero-text {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 460px;
}

.cat-hero-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: #e8f0fe;
  color: #1f6fe5;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.cat-hero .cat-title {
  margin: 10px 0 8px;
  color: #0f1b3d;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -1px;
}

.cat-hero .cat-desc {
  margin: 0;
  color: #475569;
  font-size: 16.5px;
  line-height: 1.55;
}

/* Collage of the latest covers, fading into the card from the right */
.cat-hero-art {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50%;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 38%);
  mask-image: linear-gradient(to right, transparent 0, #000 38%);
  pointer-events: none;
}

.cat-hero-cover {
  position: absolute;
  width: 230px;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 0;
  object-fit: cover;
  border: 5px solid #fff;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .18);
}

.cat-hero-cover--1 {
  z-index: 3;
  top: 30px;
  right: 34px;
  transform: rotate(4deg);
}

.cat-hero-cover--2 {
  z-index: 2;
  top: 64px;
  right: 196px;
  width: 210px;
  transform: rotate(-5deg);
}

.cat-hero-cover--3 {
  z-index: 1;
  top: 22px;
  right: 350px;
  width: 190px;
  transform: rotate(3deg);
}

/* Chips: the section's quick links */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 24px;
  padding: 12px;
  border: 1px solid #edf1f7;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .04);
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid #e3eaf5;
  border-radius: 10px;
  background: #fff;
  color: #0f1b3d !important;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.cat-chip .ff-hl-icon {
  display: inline-flex;
  color: #1f6fe5;
}

.cat-chip .ff-hl-icon svg {
  display: block;
  width: 17px;
  height: 17px;
  max-width: none;
  fill: currentColor;
}

.cat-chip:hover {
  border-color: #bcd3f7;
  background: #f3f7ff;
  color: #1f6fe5 !important;
}

html[data-theme="dark"] .cat-hero,
html[data-theme="dark"] .cat-chips,
html[data-theme="dark"] .cat-chip {
  border-color: var(--dica-border);
  background: var(--dica-surface-raised);
  box-shadow: none;
}

html[data-theme="dark"] .cat-hero .cat-title,
html[data-theme="dark"] .cat-chip {
  color: var(--dica-ink) !important;
}

html[data-theme="dark"] .cat-hero .cat-desc {
  color: var(--dica-muted);
}

html[data-theme="dark"] .cat-hero-pill {
  background: var(--dica-action-soft);
  color: var(--dica-action);
}

html[data-theme="dark"] .cat-hero-cover {
  border-color: var(--dica-surface-raised);
}

html[data-theme="dark"] .cat-chip:hover {
  background: var(--dica-action-soft);
  color: var(--dica-action) !important;
}

@media (max-width: 1100px) {
  .cat-hero-art {
    width: 42%;
  }

  .cat-hero-cover--3 {
    display: none;
  }
}

@media (max-width: 860px) {
  .cat-hero-art {
    display: none;
  }

  .cat-hero-text {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .cat-hero {
    gap: 16px;
    min-height: 0;
    padding: 20px;
    border-radius: 16px;
  }

  .cat-hero-ico {
    width: 64px;
    height: 64px;
    border-radius: 18px;
  }

  .cat-hero-ico .ff-hl-icon,
  .cat-hero-ico .ff-hl-icon svg {
    width: 30px;
    height: 30px;
  }

  .cat-hero .cat-title {
    margin: 8px 0 6px;
    font-size: 30px;
  }

  .cat-hero .cat-desc {
    font-size: 15px;
  }

  /* One swipeable row instead of wrapping into a tall block */
  .cat-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .cat-chips::-webkit-scrollbar {
    display: none;
  }
}
