/* holypuzzle.com home page (templates/holypuzzle/holypuzzle-home.html). The navbar's styles live in
   jigsawfun/navbar.css and use the color tokens defined here. */
:root {
  --bg: #f4f1ec;
  --panel: #ffffff;
  --text: #1f1d1a;
  --muted: #6d675f;
  --line: #e0dbd3;
  --accent: #c2410c;
  --shadow: 0 10px 30px rgba(31, 29, 26, 0.12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --panel: #211f1c;
    --text: #f1ede7;
    --muted: #a39c92;
    --line: #36322d;
    --accent: #fb923c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 16px 40px;
}
header { max-width: 1100px; margin: 0 auto 20px; text-align: center; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0; }
.sub a { color: var(--accent); }

/* Masonry: the script deals each card into the shortest .col, so "Load more" only appends
   and cards already on screen never move (CSS columns would re-flow them all) */
.masonry {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.masonry .col { flex: 1; min-width: 0; }
.card {
  display: block;
  position: relative;
  margin-bottom: 14px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--line);
  box-shadow: var(--shadow);
  transform: translateZ(0); /* keeps rounded corners clipping during hover scale */
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .35s ease, opacity .4s;
  opacity: 0;
}
.card img.loaded { opacity: 1; }
/* "Play jigsaw" pill (the card's data-play-label, in the page's language), always shown in the
   middle; it turns orange and grows a little on hover */
.card::after {
  content: "\25B6\FE0E  " attr(data-play-label); /* ▶ as text, not an emoji */
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .6); color: #fff;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  padding: 7px 16px; border-radius: 999px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: background .2s, transform .2s;
  pointer-events: none;
}
/* Categories + name, always shown over a bottom gradient so white text reads on any photo */
.card .caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 36px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, .35) 60%, transparent);
  color: #fff;
  pointer-events: none;
}
.card .categories { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.card .categories:empty { display: none; }
.card .category {
  display: inline-block; max-width: 100%;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent); color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .name {
  font-size: 16px; font-weight: 700; line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card:hover img, .card:focus-visible img { transform: scale(1.04); }
.card:hover::after, .card:focus-visible::after { background: var(--accent); transform: translate(-50%, -50%) scale(1.06); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

@media (max-width: 600px) {
  .masonry { gap: 8px; }
  .card { margin-bottom: 8px; border-radius: 8px; }
  .card::after { font-size: 12px; padding: 5px 12px; }
  .card .caption { padding: 28px 10px 8px; }
  .card .categories { gap: 3px; margin-bottom: 3px; }
  .card .category { font-size: 10px; padding: 2px 7px; }
  .card .name { font-size: 13px; }
}

/* Category filter chips; they scroll sideways on narrow screens rather than wrapping into many rows */
.filters {
  max-width: 1100px; margin: 0 auto 18px;
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.chip {
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--accent); }
.chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 600px) {
  .filters {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto;
    margin: 0 -16px 14px; padding: 2px 16px 6px; scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
}
#grid.loading { opacity: .5; transition: opacity .15s; }

.empty { max-width: 480px; margin: 40px auto; text-align: center; color: var(--muted); }
.empty a { color: var(--accent); }

.more { display: flex; justify-content: center; margin-top: 12px; }
.more button {
  font: inherit; font-size: 14px; color: #fff;
  background: var(--accent); border: 0; border-radius: 8px;
  padding: 9px 20px; cursor: pointer;
}
.more button:hover { filter: brightness(1.08); }
.more button:disabled { opacity: .6; cursor: default; filter: none; }
