/* dmari.de - Text index: variant A tile grid (quiet grid, 3/2/1 columns). 2026-09-28.
   Loaded only by text.html (body.text-tiles), after /css/styles.css and /css/text-filter.css; uses their tokens only
   (--ink, --mute, --faint, --line, --font-ui, --bg). Shared CSS/JS unchanged.
   Layout math for the img sizes attribute in text.html: .text-index = min(100%, 72rem) with 1.25rem side padding,
   list max 68rem (1088px); 3 cols >1080px (gap 2.25rem) -> max tile 338.67px; 2 cols 641-1080px (gap 1.75rem)
   -> (100vw - 68px) / 2; 1 col <=640px -> 100vw - 40px. Keep sizes in sync if gaps/breakpoints change. */


.text-tiles .text-index-head,
.text-tiles .text-filter,
.text-tiles .text-index-list { max-width: min(100%, 68rem); }

.text-tiles .text-index-head { margin-bottom: 1.75rem; }
.text-tiles .text-filter { margin: 0 auto 2.5rem; }

.text-tiles .text-index-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3.25rem 2.25rem;
}
.text-tiles #text-list.is-filtered { border-bottom: 0; }

.tile { border: 0; margin: 0; }
.tile[hidden] { display: none; }
.tile:last-child { border-bottom: 0; }

.tile-inner {
  position: relative; /* stretched link target */
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tile-media {
  order: -1;
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 5%, var(--bg));
  margin-bottom: 0.95rem;
}

.tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* tile files are 1200:630 (900x473 rounds 0.5 px); cover only guards rounding */
  transition: opacity 0.25s ease;
}

.tile-meta {
  margin: 0 0 0.4rem;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* one quiet line; full group names live in the filter */
}
.tile-sep { color: var(--faint); }

.tile-title {
  margin: 0 0 0.45rem;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: color-mix(in srgb, var(--ink) 92%, transparent);
  text-wrap: pretty;
}

.tile-link { outline: 0; }
.tile-link::after { /* whole tile clickable; link text stays the title */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.tile-link:hover { opacity: 1; }

.tile-excerpt {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--mute);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.tile-inner:hover .tile-img { opacity: 0.86; }
.tile-inner:hover .tile-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent); }

.tile-inner:has(.tile-link:focus-visible) { outline: 1px solid var(--ink); outline-offset: 6px; }
.tile-link:focus-visible { text-decoration: underline; }

@media (max-width: 1080px) {
  .text-tiles .text-index-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.75rem 1.75rem; }
}
@media (max-width: 640px) {
  .text-tiles .text-index-list { grid-template-columns: 1fr; gap: 2.5rem; }
  .text-tiles .text-filter { margin: -0.5rem auto 1.75rem; }
  .tile-title { font-size: 1.0625rem; }
}
@media (prefers-reduced-motion: reduce) { .tile-img { transition: none; } }
