/*
 * Indice visual compartido de secciones · AC Trenzas Studio.
 *
 * Distribuye las rutas en todo el ancho disponible:
 * 3 opciones = 3 columnas, 4 = 2 × 2 y 5 = 3 + 2.
 */

.ac-section-index {
  --ac-index-line: var(--ac-line, var(--line, rgb(59 46 40 / 15%)));
  --ac-index-surface: var(--ac-paper, var(--paper, #fdf8f1));
  --ac-index-surface-hover: var(--ac-ivory, var(--ivory, #fbf5ee));
  --ac-index-text: var(--ac-charcoal, var(--charcoal, #3b2e28));
  --ac-index-accent: var(--ac-copper-text, var(--copper-dark, var(--copper, #8a4c40)));
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  border: 0;
  padding: 1px;
  overflow: hidden;
  background: var(--ac-index-line);
}

.ac-section-index > a {
  grid-column: span 4;
  min-width: 0;
  min-height: 76px;
  border: 0;
  padding: 16px clamp(15px, 2vw, 24px);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  gap: 12px;
  align-items: center;
  color: var(--ac-index-text);
  background: var(--ac-index-surface);
  font-size: clamp(.72rem, 1vw, .82rem);
  font-weight: 700;
  letter-spacing: .075em;
  line-height: 1.35;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .2s ease, background-color .2s ease;
}

/* Gana a las reglas antiguas de cada índice sin depender de su hoja de origen. */
.ac-section-index[data-count] > a {
  border: 0;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  justify-content: normal;
}

.ac-section-index > a:hover,
.ac-section-index > a:focus-visible {
  padding-left: clamp(15px, 2vw, 24px);
  color: var(--ac-index-accent);
  background: var(--ac-index-surface-hover);
}

.ac-section-index > a:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid var(--ac-index-accent);
  outline-offset: -4px;
}

.ac-section-index > a .ac-section-index__number {
  color: var(--ac-index-accent);
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.08rem;
  font-weight: 500;
  letter-spacing: 0;
}

.ac-section-index > a .ac-section-index__label {
  min-width: 0;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  line-height: inherit;
  overflow-wrap: anywhere;
}

.ac-section-index__icon {
  color: var(--ac-index-accent);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  text-align: right;
}

.ac-section-index[data-count="1"] > a {
  grid-column: span 12;
}

.ac-section-index[data-count="2"] > a,
.ac-section-index[data-count="4"] > a {
  grid-column: span 6;
}

.ac-section-index[data-count="5"] > a:nth-child(-n + 3) {
  grid-column: span 4;
}

.ac-section-index[data-count="5"] > a:nth-child(n + 4) {
  grid-column: span 6;
}

.ac-section-index[data-count="6"] > a {
  grid-column: span 4;
}

.ac-section-index[data-count="7"] > a:nth-child(-n + 4),
.ac-section-index[data-count="8"] > a {
  grid-column: span 3;
}

.ac-section-index[data-count="7"] > a:nth-child(n + 5) {
  grid-column: span 4;
}

/* El borrador de Productos vive dentro del ancho editorial de Gutenberg. */
.entry-content .products-hero {
  width: min(1192px, calc(100vw - 48px));
  max-width: none;
  margin-right: 0;
  margin-left: 50%;
  transform: translateX(-50%);
}

.entry-content .group-nav.ac-section-index {
  width: 100%;
  max-width: none;
  margin-right: 0;
  margin-left: 0;
  transform: none;
}

@media (max-width: 900px) {
  .ac-section-index > a,
  .ac-section-index[data-count] > a,
  .ac-section-index[data-count="5"] > a:nth-child(n),
  .ac-section-index[data-count="7"] > a:nth-child(n) {
    grid-column: span 6;
  }

  .ac-section-index[data-count="1"] > a,
  .ac-section-index[data-count="3"] > a:last-child,
  .ac-section-index[data-count="5"] > a:last-child,
  .ac-section-index[data-count="7"] > a:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .ac-section-index > a,
  .ac-section-index[data-count] > a,
  .ac-section-index[data-count="5"] > a:nth-child(n),
  .ac-section-index[data-count="7"] > a:nth-child(n) {
    grid-column: 1 / -1;
    min-height: 66px;
  }

  .entry-content .products-hero {
    width: calc(100vw - 36px);
  }
}
