/* ================================================================
   NICKDECKER.NET / THE LIBRARY
   A complete, clickable index of every category and title, living
   inside the pink ".writers" section. Each category is its own
   palette-coloured card (black stroke, slightly rounded) so the
   black text stays easy to scan. Shares design tokens from
   styles.css; built by Assets/js/library.js from window.LIBRARY.
   ================================================================ */

/* the pink section needs to anchor the corner "open" arrow */
.writers { position: relative; }

/* ----- corner arrow → open the reading list on its own page ----- */
.writers__open {
  position: absolute;
  top: clamp(1rem, 2.5vw, 2rem);
  right: clamp(1rem, 2.5vw, 2rem);
  z-index: 5;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--cream);
  color: var(--ink);
  transition: transform 0.25s var(--ease), background 0.2s ease, color 0.2s ease;
}
.writers__open svg { width: 1.3rem; height: 1.3rem; display: block; }
.writers__open:hover,
.writers__open:focus-visible {
  background: var(--ink);
  color: var(--cream);
  transform: translate(2px, -2px);
}

.library-index {
  width: 100%;
  max-width: 84rem;
  margin: var(--space-xl) auto 0;
  columns: 3 18rem;
  column-gap: var(--space-md);
  color: var(--ink);
}

/* ----- the cards ----------------------------------------------- */
.index-group {
  break-inside: avoid;
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-sm) calc(var(--space-sm) - 0.32rem);
  border: 1.5px solid var(--ink);           /* matches the --hair divider width */
  border-radius: 0.55rem;
  background: var(--cream);                  /* default; cycled below */
}
/* Per-category palette, hand-tuned so no two adjacent cards (within a
   column, across columns, or stacked on mobile) share a colour. */
.index-group:nth-child(1)  { background: var(--cream);  }  /* Architecture   */
.index-group:nth-child(2)  { background: var(--red);    }  /* Ethos          */
.index-group:nth-child(3)  { background: var(--ink);    }  /* Desire         */
.index-group:nth-child(4)  { background: var(--yellow); }  /* Play           */
.index-group:nth-child(5)  { background: var(--blue);   }  /* Love           */
.index-group:nth-child(6)  { background: var(--cream);  }  /* Propaganda     */
.index-group:nth-child(7)  { background: var(--yellow); }  /* Technology     */
.index-group:nth-child(8)  { background: var(--ink);    }  /* Civilizational */
.index-group:nth-child(9)  { background: var(--cream);  }  /* Work           */
.index-group:nth-child(10) { background: var(--red);    }  /* Art            */
.index-group:nth-child(11) { background: var(--blue);   }  /* Existentialism */
.index-group:nth-child(12) { background: var(--yellow); }  /* Literature     */

/* black cards: invert the type to cream so it stays legible */
.index-group:nth-child(3) .index-group__name,
.index-group:nth-child(3) a,
.index-group:nth-child(3) .idx-author,
.index-group:nth-child(8) .index-group__name,
.index-group:nth-child(8) a,
.index-group:nth-child(8) .idx-author { color: var(--cream); }
.index-group:nth-child(3) a,
.index-group:nth-child(8) a { border-bottom-color: rgba(242, 227, 202, 0.22); }

.index-group__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--type-label);
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.index-group ul { list-style: none; margin: 0; padding: 0; }
.index-group li { margin: 0; }
.index-group a {
  display: block;
  padding: 0.32rem 0;
  font-family: var(--font-body);
  font-size: var(--type-fine);
  line-height: 1.3;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid rgba(31, 31, 29, 0.2);
  transition: padding-left 0.2s var(--ease);
}
.index-group li:last-child a { border-bottom: 0; }
.index-group a:hover { padding-left: 0.3rem; text-decoration: underline; }
.index-group a .idx-author { font-style: italic; color: var(--ink); }

@media (max-width: 760px) {
  .library-index { columns: 1; }
}

/* ================================================================
   STANDALONE PAGE CHROME (/readinglist) — back bar + footer
   ================================================================ */
.rl-top {
  background: var(--cream);
  border-bottom: var(--hair);
  padding: var(--space-sm) var(--gutter);
}
.rl-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-family: var(--font-body);
  font-size: var(--type-fine);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  transition: gap 0.25s var(--ease);
}
.rl-back:hover { gap: 1ch; }

/* on its own page the section need not fill the viewport height */
.writers--page { padding-block: var(--space-lg) var(--space-xl); }

.rl-foot {
  background: var(--cream);
  padding: var(--space-lg) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}
