/* The purple listing pages: Printables (pages/purple/printables.php) and Worksheet Makers
   (pages/purple/generators.php); docs/purple-rollout.md, steps 2 and 3. Script: js/purple-listing.js.
   Design: mockups/redesign/site-a-hub/live/printables.html (Blake's mockup, 2026-09-28):
   a white filter card on the left (Which grade? / Which topic?, pill rows with live counts)
   and one white panel on the right holding printable cards. One page scroll.
   Colours come from the --pv-* variables in css/purple-skin.css. */
body.pv-body { margin: 0; }
.pl-top { background: #fff; border-bottom: 1px solid var(--pv-line); }
.pl-top .pv-wrap { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.pl-top .lbl { font: 700 21px 'Fredoka', sans-serif; color: var(--pv-plum); }
.pl-find { flex: 1 1 380px; max-width: 620px; display: flex; align-items: center; background: var(--pv-bg); border-radius: 999px; padding: 4px; }
.pl-find input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 9px 16px; font: 500 14px 'DM Sans', sans-serif; color: var(--pv-ink); }
.pl-find input::placeholder { color: #8f86ad; }
.pl-find input { text-overflow: ellipsis; }
.pl-find button { border: 0; border-radius: 999px; background: var(--pv-orange); color: var(--pv-plum); font: 700 13.5px 'DM Sans', sans-serif; padding: 10px 20px; cursor: pointer; }
.pl-find button:hover { background: var(--pv-orange-d); }

.pl { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 18px; align-items: stretch; padding-top: 20px; padding-bottom: 20px; }
.pl-card, .pl-panel { background: #fff; border-radius: 24px; box-shadow: 0 6px 20px rgba(52,30,96,.05); }
/* two cards stacked in the left column: Which grade? and Which topic? (2026-09-30) */
.pl-rail { display: flex; flex-direction: column; gap: 18px; align-self: start; }
.pl-card { padding: 20px 12px; }
.pl-rail h3 { font: 600 19px 'Fredoka', sans-serif !important; color: var(--pv-plum); margin: 0 4px 10px; }
.pl-rail h3 + .opts { margin-bottom: 0; }
.opts { display: grid; gap: 7px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; background: var(--pv-cream); border: 2px solid transparent; border-radius: 999px; padding: 4px 10px; font: 700 13.5px 'DM Sans', sans-serif; color: var(--pv-plum); cursor: pointer; text-align: left; transition: border-color .12s, background .12s; }
.opt:hover { border-color: var(--pv-lav); }
.opt.on { border-color: var(--pv-violet); }
.opt small { font-weight: 600; font-size: 12px; color: var(--pv-muted); }
/* no box around the search field when it is clicked into (Blake, 2026-10-06) */
.pl-find input:focus, .pl-find input:focus-visible { outline: 0; }
.opt:focus-visible, .pc:focus-visible { outline: 3px solid rgba(99,75,245,.35); outline-offset: 2px; }
.opts.grades .opt { font: 600 16px 'Fredoka', sans-serif; color: var(--pv-violet); }
.opts.grades .opt small { font-family: 'DM Sans', sans-serif; }

.pl-panel { padding: 22px 22px 28px; min-width: 0; }
.pl-head { text-align: center; margin-bottom: 20px; }
.pl-head h1 { font: 600 30px 'Fredoka', sans-serif !important; color: var(--pv-plum) !important; margin: 0; line-height: 1.15; }
.pl-head h1 span { color: var(--pv-violet); }
.pl-head .sub { font-size: 12.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--pv-violet-d); margin-top: 4px; }
.pl-head .sub a { color: var(--pv-violet); cursor: pointer; text-transform: none; letter-spacing: 0; margin-left: 8px; font-weight: 700; }

.pl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.pc { display: flex; flex-direction: column; background: var(--pv-cream); border: 0; border-radius: 22px; overflow: hidden; transition: transform .15s, box-shadow .15s; text-decoration: none; color: inherit; }
.pc:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(52,30,96,.12); }
.pc .thumb { background: #efe9f9; height: 150px; overflow: hidden; padding: 12px 14px 0; }
.pc .thumb img { width: 100%; display: block; border-radius: 8px 8px 0 0; box-shadow: 0 3px 10px rgba(0,0,0,.1); }
/* Stack (2026-09-30 option): a printable with more than one worksheet shows its first three
   pages as a fanned pile, "A · Stack" from hub-cards.html without the round badges. Hover
   fans it wider. Page 1 is the pack's thumb.webp; pages 2-3 come from live/stack/ (made by
   scripts/purple-stack-thumbs.mjs). Same height as a normal thumb, so rows stay even. */
.pc .stack { position: relative; height: 162px; background: linear-gradient(160deg, #efe9f9, #e4dcff); overflow: hidden; }
.pc .stack .sheet { position: absolute; left: 50%; top: 22px; width: 44%; aspect-ratio: 8.5 / 11; background: #fff; border-radius: 6px; box-shadow: 0 6px 16px rgba(52,30,96,.22); overflow: hidden; transition: transform .25s ease; }
.pc .stack .sheet img { width: 100%; display: block; }
.pc .stack .s1 { transform: translateX(-92%) rotate(-9deg); }
.pc .stack .s2 { transform: translateX(-50%) rotate(0); z-index: 2; top: 14px; }
.pc .stack .s3 { transform: translateX(-8%) rotate(9deg); }
.pc:hover .stack .s1 { transform: translateX(-104%) rotate(-12deg); }
.pc:hover .stack .s3 { transform: translateX(4%) rotate(12deg); }
@media (prefers-reduced-motion: reduce) { .pc .stack .sheet { transition: none; } }
.pc .thumb { height: 162px; box-sizing: border-box; }
.pc .info { padding: 14px 14px 16px; }
.pc b { display: block; font: 600 17px 'Fredoka', sans-serif; color: var(--pv-plum); line-height: 1.2; }
.pc .m { font-size: 12.5px; color: var(--pv-muted); margin-top: 3px; }
.chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chip { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; border-radius: 999px; padding: 4px 9px; background: #ece8ff; color: #4a37c9; }
.chip.pages { background: #d8f5ec; color: #1f6a55; }
.chip.maker { background: #ffe9c6; color: #8a4b00; }
.chip.season { background: #ffe0ff; color: #8a1f8a; }
.more { text-align: center; margin-top: 24px; }
.more button { border: 2px solid var(--pv-line); background: #fff; color: var(--pv-plum); border-radius: 999px; padding: 10px 22px; font: 700 14px 'DM Sans', sans-serif; cursor: pointer; }
.more button:hover { border-color: var(--pv-lav); }
.empty { text-align: center; color: var(--pv-muted); padding: 40px 10px; }
.empty a, .suggest a { color: var(--pv-violet); font-weight: 700; }
.empty .try { cursor: pointer; }

.suggest { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: #fff; border-radius: 24px; padding: 18px 24px; margin-bottom: 8px; box-shadow: 0 6px 20px rgba(52,30,96,.05); }
.suggest b { font: 600 18px 'Fredoka', sans-serif; color: var(--pv-plum); }
.suggest p { margin: 2px 0 0; color: var(--pv-muted); font-size: 14px; }
/* What the page is and how to use it, as a quiet card under everything (as the hubs' "About these
   worksheets"; Blake, 2026-10-06): the words a visitor and a search engine look for */
.about { margin: 14px 0 8px; padding: 18px 24px; border-radius: 20px; background: rgba(255,255,255,.55); border: 1px solid var(--pv-line); }
.about h2 { font: 600 16px 'Fredoka', sans-serif !important; color: var(--pv-plum) !important; margin: 0 0 6px; }
.about p { font-size: 13.5px; color: var(--pv-muted); line-height: 1.6; margin: 0; max-width: 900px; }
.suggest .go { background: var(--pv-orange); color: var(--pv-plum) !important; border-radius: 999px; padding: 10px 20px; text-decoration: none; }

@media (max-width: 1100px) { .pl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .pl { grid-template-columns: 1fr; }
  .opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opts.grades { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pl-rail { gap: 14px; }
  .pl-panel { padding: 18px 14px 22px; }
  .pl-head h1 { font-size: 24px !important; }
}
@media (max-width: 520px) { .pl-grid { grid-template-columns: 1fr; } }
.pl-head.v-b, .pl-head.v-c, .pl-head.v-d { text-align: left; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 2px 4px 18px; }
.pl-head.v-b h1 { font: 600 24px 'Fredoka', sans-serif !important; color: var(--pv-plum) !important; margin: 0; }
.pl-head .n { font-size: 13.5px; font-weight: 600; color: var(--pv-muted); }
.pl-head .n b { color: var(--pv-plum); }
.pl-head .clr { margin-left: auto; color: var(--pv-violet); font: 700 13.5px 'DM Sans', sans-serif; cursor: pointer; text-decoration: none; }
.pl-head .clr:hover { text-decoration: underline; }
.pl-head.v-c { align-items: center; }
.pl-head.v-c .big { font: 600 24px 'Fredoka', sans-serif; color: var(--pv-plum); }
.pl-head.v-c .big small { font: 600 15px 'DM Sans', sans-serif; color: var(--pv-muted); margin-left: 4px; }
.pl-head .fchip { display: inline-flex; align-items: center; gap: 6px; font: 700 12.5px 'DM Sans', sans-serif; border-radius: 999px; padding: 5px 11px; background: var(--pv-bg); color: var(--pv-muted); }
.pl-head .fchip.on { background: #ece8ff; color: var(--pv-violet-d); cursor: pointer; }
.pl-head .fchip.on:hover { background: #ddd6ff; }
.pl-head .fchip i { font-style: normal; font-size: 14px; line-height: 1; opacity: .7; }
.pl-head.v-d p { margin: 0; font: 500 18px/1.4 'DM Sans', sans-serif; color: #4b3f6b; }
.pl-head.v-d p b { font-family: 'Fredoka', sans-serif; font-weight: 600; color: var(--pv-plum); }
.pl-head.v-e { align-items: center; }
.pl-head.v-d p em { font-style: normal; font-weight: 700; color: var(--pv-violet-d); }

/* The page's main heading is the label beside the search box */
body.pv-body .pl-top h1.lbl { font: 700 21px 'Fredoka', sans-serif !important; color: var(--pv-plum) !important; margin: 0; letter-spacing: normal !important; }
/* Counts are drawn from data-n so a pill's own text stays just its name (the visit tracker
   records that text as the filter value) */
.opt small::after { content: attr(data-n); }
/* The cards are all in the page; the script hides the ones the filters leave out */
.pc[hidden], .empty[hidden] { display: none; }
/* Worksheet Makers cards: the card icon on the icon background, framed like a sheet, and two
   lines of description */
.pc .thumb .icon { height: 100%; background: #f7f8fc; border-radius: 8px 8px 0 0; box-shadow: 0 3px 10px rgba(0,0,0,.1); display: grid; place-items: center; }
.pc .thumb .icon img { width: 72%; height: 88%; object-fit: contain; display: block; border-radius: 0; box-shadow: none; }
/* up to four lines of the description show and only longer ones are cut (two lines until 2026-10-08) */
.pc .desc { font-size: 13px; color: #4b3f6b; line-height: 1.45; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* "Everything here is free": a soft line along the top of the panel, under the count line
   (includes/purple/free-banner.php; Blake, 2026-10-06). .rise = its arrival, once per visit. */
.pl-free { display: flex; align-items: center; gap: 10px; background: #e9faf4; border-radius: 16px; padding: 11px 16px; margin: -6px 0 16px; font-size: 14px; font-weight: 600; color: #1f5a49; }
.pl-free b { font-weight: 800; }
.pl-free i { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #1f9d76; color: #fff; display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 800; }
.pl-free .w { display: inline-block; }
.pl-free.rise { animation: plFreeUp .5s cubic-bezier(.2,.8,.2,1) both; }
.pl-free.rise .w { animation: plFreeWord .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(.25s + var(--i) * .055s); }
.pl-free.rise i { animation: plFreePop .6s cubic-bezier(.3,1.6,.5,1) .15s both; }
@keyframes plFreeUp { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes plFreeWord { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes plFreePop { from { transform: scale(0); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pl-free.rise, .pl-free.rise .w, .pl-free.rise i { animation: none; } }
