/* The truisms pages: the grid on public/truisms/index.html (one tile for each truism card, each tile a link to its card)
   and the parts both truisms pages share (the page switch, the counts, the search and filter bar). The index and the
   research page (public/truisms/research/index.html) load this after app.css; no other page does.

   Colours. The owner's card colours, as in truisms.css, kept out of app.css on purpose (README, Look). The tile is the
   card's blue with the card's lime for the label, so a tile reads as a small copy of its card.

   Size. No media query: the grid fills the row with as many 220 px tiles as fit, so a phone gets one column and a
   desktop gets three or four. A tile is a square at least 220 px wide. */

/* The app column is 480 px, which holds one tile across. The index is wider so the tiles make a grid. */
.app.truisms-index,
.app.truisms-research {
  max-width: 1100px;
}

/* The hidden attribute must win over the display rules below. */
.app.truisms-index [hidden],
.app.truisms-research [hidden] {
  display: none !important;
}

/* The page switch: Truisms and Research notes, each way to the other. Plain links on the app's own colours. */
.tnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.tnav a[aria-current='page'] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}
.tnav a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* Counts under the introduction. */
.tstats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
}
.tstats > div {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.tstats dt {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.tstats dd {
  margin: 2px 0 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

/* Search and filter. Hidden until the script runs, because without it the controls would do nothing. */
.tfilter {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.tfilter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.tfilter-row .field {
  flex: 1 1 220px;
}
.tfilter-row .btn {
  flex: 0 0 auto;
  width: auto;
}
.tchips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tcount {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.tempty {
  padding: 24px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  text-align: center;
}

/* A tile and, when the truism has research notes, a link under it to those notes. */
/* A list item is a tile and, for a truism with notes, a link under it. The tile takes the column's width and is a square from
   it: it must not grow to fill the item, because with its square aspect ratio a taller item would make it wider than its column
   and run it over the next tile. min-width 0 lets the column set the width. */
.truism-grid li {
  display: flex;
  flex-direction: column;
  align-self: start;
  min-width: 0;
  gap: 8px;
}
.truism-grid li > .tile {
  flex: none;
  width: 100%;
  box-sizing: border-box;
}
.truism-grid .tile-research {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
}

.truism-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.truism-grid .tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  aspect-ratio: 1 / 1;
  min-height: 220px;
  padding: 18px;
  border-radius: 12px;
  background: #0b23ef;
  color: #fff;
  text-decoration: none;
  overflow-wrap: break-word;
}

.truism-grid .tile-label {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d5ff4f;
}

.truism-grid .tile-headline {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.truism-grid .tile-go {
  align-self: flex-start;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: #cad0ff;
  color: #0a0a8c;
}

.truism-grid .tile:hover .tile-go,
.truism-grid .tile:focus-visible .tile-go {
  background: #d5ff4f;
}

.truism-grid .tile:focus-visible {
  outline: 3px solid #0a0a8c;
  outline-offset: 3px;
}

/* Air between one topic's tiles and the next topic's heading. */
.truisms-index [data-group] {
  margin-top: 20px;
}
