/* Shared category lists: preserve the server-rendered headings, order and links. */
/* Point/guide pages nest this section inside another Bootstrap container. */
.container > #ListaCategorie.container {
  width: 100%;
}

#categoriesPlaceHolder {
  --category-row-unit: 4px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-flow: row;
  align-items: start;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
  text-align: left;
}

/* Enabled only after natural card heights have been measured. */
#categoriesPlaceHolder.categories-compact {
  grid-auto-rows: var(--category-row-unit);
  row-gap: 0;
}

/* Flatten the legacy rows of three, so tablet columns flow without empty slots. */
#categoriesPlaceHolder > .row {
  display: contents;
  margin: 0;
}

#categoriesPlaceHolder > .row::before,
#categoriesPlaceHolder > .row::after {
  display: none;
}

#categoriesPlaceHolder > .row > .col-md-4,
#categoriesPlaceHolder > .row > .col-12 {
  --category-ink: #225c8b;
  --category-tint: #eff5fb;
  --category-hover: #e2eef9;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  gap: 8px;
  float: none;
  width: auto;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 20px;
  border: 1px solid #e1e8ef;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 20px rgba(0, 60, 112, .05);
  text-align: left;
}

#categoriesPlaceHolder > .row > :nth-child(3n + 2) {
  --category-ink: #865322;
  --category-tint: #fcf5eb;
  --category-hover: #f7ebda;
}

#categoriesPlaceHolder > .row > :nth-child(3n) {
  --category-ink: #346b54;
  --category-tint: #eff7f2;
  --category-hover: #e1efe6;
}

/* The macro-category view can contain a single, full-width group. */
#categoriesPlaceHolder > .row > .col-12 {
  grid-column: 1 / -1;
}

#categoriesPlaceHolder > .row > div > h2 {
  box-sizing: border-box;
  flex: 0 0 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 0 0 16px;
  border-bottom: 1px solid #e8edf2;
  color: #003c70;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  text-transform: none;
  white-space: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
}

#categoriesPlaceHolder a.btn-tag,
#categoriesPlaceHolder a.btn-tag:visited {
  box-sizing: border-box;
  display: inline-block;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
  /* Override the legacy !important declarations and inline tag margins. */
  margin: 0 !important;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background-color: var(--category-tint, #eff5fb) !important;
  background-image: none;
  color: var(--category-ink, #225c8b) !important;
  box-shadow: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  text-decoration: none;
  text-shadow: none;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  transition: background-color .16s ease, border-color .16s ease;
}

#categoriesPlaceHolder a.btn-tag > .fa-tag {
  margin-inline-end: 4px;
  font-size: 12px;
  opacity: .65;
}

@media (hover: hover) {
  #categoriesPlaceHolder a.btn-tag:hover {
    border-color: var(--category-ink, #225c8b);
    background-color: var(--category-hover, #e2eef9) !important;
    text-decoration: none;
  }
}

#categoriesPlaceHolder a.btn-tag:focus-visible {
  outline: 3px solid #003c70;
  outline-offset: 3px;
  background-color: var(--category-hover, #e2eef9) !important;
  text-decoration: none;
}

#categoriesPlaceHolder a.btn-tag:active {
  background-color: var(--category-hover, #e2eef9) !important;
  text-decoration: none;
}

@media (min-width: 768px) {
  #categoriesPlaceHolder {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  #categoriesPlaceHolder {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 479px) {
  #categoriesPlaceHolder {
    gap: 14px;
  }

  #categoriesPlaceHolder > .row > .col-md-4,
  #categoriesPlaceHolder > .row > .col-12 {
    padding: 16px;
  }

  #categoriesPlaceHolder a.btn-tag {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #categoriesPlaceHolder a.btn-tag {
    transition: none;
  }
}
