/* =========================================================================
   Mission 301 — Catalog listing page (html_4)
   Builds on style.css theme variables. Gold on dark, Cormorant + Aptos.
   ========================================================================= */

.catpage { padding-top: var(--header-h); }

/* ---------------- Page hero ---------------- */
.cathero { padding: clamp(34px, 6vw, 64px) 0 clamp(24px, 3vw, 36px); }
.crumbs { display: flex; justify-content: center; gap: 10px; margin: 0 0 22px; font-family: var(--font-head); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--body-dim); }
.crumbs a { color: var(--body-dim); transition: color .2s; }
.crumbs a:hover { color: #FBAB04; }
.crumbs span[aria-hidden] { color: var(--gold-deep); }
.cathero__title { margin: 8px auto 0; }
.cathero__rule { width: min(300px, 70%); margin: 18px auto 22px; }
.cathero__rule span:first-child { background: linear-gradient(90deg, transparent, var(--gold-muted)); }
.cathero__rule span:last-child { background: linear-gradient(90deg, var(--gold-muted), transparent); }
.cathero__intro { max-width: 760px; }

/* assignment status: a warm sage green, close to verdigris on gilt bronze, so
   it reads clearly without fighting the gold */
:root { --taken: #7da45f; --taken-deep: #4e6c3b; }

/* ---------------- Layout: filters left, results right ---------------- */
.catbody { padding: clamp(26px, 4vw, 44px) 0 clamp(60px, 8vw, 96px); }
.catlayout { display: grid; grid-template-columns: clamp(240px, 21vw, 300px) minmax(0, 1fr); gap: clamp(26px, 3vw, 48px); align-items: start; }

.cside__inner { position: sticky; top: calc(var(--header-h-compact) + 20px); }
.cside__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.cside__title { margin: 0; font-family: var(--font-head); font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-bright); }
.cside__clear { padding: 0; background: none; border: 0; cursor: pointer; font-family: var(--font-head); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--body-dim); transition: color .2s; }
.cside__clear:hover { color: var(--gold-bright); }

.cside__search { position: relative; display: flex; align-items: center; margin: 18px 0; }
.cside__search svg { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--gold-muted); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.cside__search input { width: 100%; padding: 10px 12px 10px 36px; background: rgba(8, 8, 7, .5); border: 1px solid var(--gold-muted); border-radius: 3px; color: var(--text); font-family: var(--font-body); font-size: 14px; transition: border-color .2s, background .2s; }
.cside__search input:hover { border-color: var(--gold); }
.cside__search input::placeholder { color: var(--body-dim); }
.cside__search input:focus { outline: 0; border-color: var(--gold-muted); background: rgba(8, 8, 7, .7); }

.cside__block { padding: 18px 0; border-top: 1px solid var(--line-soft); }
.cside__label { margin: 0 0 12px; font-family: var(--font-head); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-muted); }

/* --- checkboxes --- */
.cbox { display: flex; align-items: center; gap: 11px; padding: 7px 0; cursor: pointer; }
.cbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.cbox__mark { position: relative; width: 15px; height: 15px; flex: 0 0 auto; border: 1px solid var(--gold-muted); border-radius: 2px; background: rgba(8, 8, 7, .5); transition: all .2s ease; }
.cbox__mark::after { content: ""; position: absolute; inset: 2px; opacity: 0; transform: scale(.5); background: linear-gradient(120deg, var(--gold), var(--gold-bright)); transition: all .2s ease; }
.cbox input:checked + .cbox__mark::after { opacity: 1; transform: none; }
.cbox:hover .cbox__mark { border-color: var(--gold-bright); }
.cbox__text { flex: 1; font-family: var(--font-body); font-size: 14px; color: var(--body-text); transition: color .2s; }
.cbox input:checked ~ .cbox__text { color: var(--gold-bright); }
.cbox__n { font-family: var(--font-head); font-size: 11px; color: var(--body-dim); }

/* --- results toolbar --- */
.ctools { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.cbar__sort { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.cbar__sort label { font-family: var(--font-head); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--body-dim); }
.cselect { position: relative; }
.cselect select { appearance: none; -webkit-appearance: none; padding: 10px 34px 10px 14px; background: rgba(8, 8, 7, .5); border: 1px solid var(--line-soft); border-radius: 3px; color: #FBAB04; font-family: var(--font-head); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.cselect select:focus { outline: 0; border-color: var(--gold-muted); }
.cselect svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 10px; height: 6px; fill: none; stroke: #FBAB04; stroke-width: 1.5; pointer-events: none; }
/* ---------------- Scripture tree ---------------- */
.ctree { display: block; }
.ctree__group { margin-bottom: 2px; }

.ctree__root { display: flex; align-items: center; gap: 10px; }
.ctree__toggle {
  display: flex; align-items: center; gap: 10px; flex: 1;
  padding: 7px 0; background: none; border: 0; cursor: pointer;
  font-family: var(--font-head); font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold-bright); transition: color .2s;
}
.ctree__toggle:hover { color: var(--gold); }
.ctree__chev { width: 10px; height: 10px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.ctree__group.is-open .ctree__chev { transform: rotate(90deg); }
.ctree__n { margin-left: auto; font-size: 11px; color: var(--body-dim); letter-spacing: .06em; }

/* checkbox-ish square used by both levels */
.ctree__box {
  position: relative; width: 14px; height: 14px; flex: 0 0 auto; padding: 0; cursor: pointer;
  border: 1px solid var(--gold-muted); border-radius: 2px; background: rgba(8, 8, 7, .5);
  transition: all .2s ease;
}
.ctree__box::after {
  content: ""; position: absolute; inset: 2px; opacity: 0; transform: scale(.5);
  background: linear-gradient(120deg, var(--gold), var(--gold-bright));
  transition: all .2s ease;
}
.ctree__root.is-all .ctree__box::after { opacity: 1; transform: none; }
.ctree__root.is-some .ctree__box::after { opacity: 1; transform: scaleY(.28); }
.ctree__box:hover { border-color: var(--gold-bright); }

.ctree__books { max-height: 0; margin: 0; padding: 0; list-style: none; overflow: hidden; transition: max-height .3s ease; }
.ctree__group.is-open .ctree__books { max-height: 340px; }
/* scrolling is switched on by JS only once the expand animation has finished,
   so the bar never flashes while the list is growing */
.ctree__books.is-scrollable { overflow-y: auto; }

/* slim gold scrollbar instead of the default chrome */
.ctree__books { scrollbar-width: thin; scrollbar-color: rgba(169, 121, 45, .45) transparent; }
.ctree__books::-webkit-scrollbar { width: 4px; }
.ctree__books::-webkit-scrollbar-track { background: transparent; }
.ctree__books::-webkit-scrollbar-thumb { background: rgba(169, 121, 45, .45); border-radius: 2px; }
.ctree__books::-webkit-scrollbar-thumb:hover { background: var(--gold-muted); }
.ctree__book {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 0 6px 24px; background: none; border: 0; cursor: pointer; text-align: left;
  font-family: var(--font-body); font-size: 14px; color: var(--body-text); transition: color .2s;
}
.ctree__book:hover { color: var(--gold-bright); }
.ctree__book.is-on { color: var(--gold-bright); }
.ctree__book.is-on .ctree__box::after { opacity: 1; transform: none; }
.ctree__book .ctree__label { flex: 1; }

/* chosen filters as removable tags */
.cchosen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ctag {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--gold-muted); border-radius: 999px; background: rgba(217, 161, 59, .1);
  font-family: var(--font-head); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-bright); transition: all .2s ease;
}
.ctag i { font-style: normal; font-size: 14px; line-height: 1; color: var(--gold-muted); }
.ctag:hover { border-color: var(--gold-bright); background: rgba(217, 161, 59, .18); }
.ctag:hover i { color: var(--gold-bright); }
.ctag--clear { background: none; border-style: dashed; color: var(--body-dim); }
.ctag--clear:hover { color: var(--gold-bright); }

.cbar__count { margin: 12px 0 0; font-family: var(--font-head); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--body-dim); }
.cbar__count b { color: #FBAB04; }

/* ---------------- Grid ---------------- */
.cgridwrap { padding: clamp(34px, 5vw, 56px) 0 clamp(60px, 8vw, 96px); }
.cgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(18px, 2vw, 28px); }

.cwork { position: relative; display: flex; flex-direction: column; border: 1px solid rgb(217 161 59); border-radius: 8px; overflow: hidden; background: #070807; transition: border-color .3s ease, box-shadow .3s ease, transform .3s ease; opacity: 0; transform: translateY(18px); }
.cwork.is-in { opacity: 1; transform: none; }
.cwork:hover { border-color: var(--gold); box-shadow: 0 20px 50px rgba(0, 0, 0, .5), 0 0 0 1px rgba(217, 161, 59, .3); transform: translateY(-4px); }

.cwork__frame { display: block; position: relative; overflow: hidden; aspect-ratio: 4 / 5; cursor: pointer; }
.cwork__frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.cwork:hover .cwork__frame img { transform: scale(1.07); }
.cwork__frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(4, 4, 3, .55) 100%); pointer-events: none; }

/* --- "artist assigned" plate --- */
.cwork__status {
  position: absolute; z-index: 3; left: 0; top: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 12px; border-radius: 0 3px 3px 0;
  background: linear-gradient(100deg, var(--taken-deep), var(--taken));
  border: 1px solid rgba(230, 245, 220, .28); border-left: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  font-family: var(--font-head); font-size: 10px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: #f4faee;
}
.cwork__status i { width: 7px; height: 7px; border-radius: 50%; background: #eafbe0; box-shadow: 0 0 8px rgba(234, 251, 224, .9); }

.cwork__tools { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; flex-direction: column; gap: 8px; }
.cwork__fav, .cwork__peek { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(231, 201, 134, .35); background: rgba(6, 7, 7, .45); backdrop-filter: blur(3px); cursor: pointer; transition: all .2s ease; }
.cwork__fav svg, .cwork__peek svg { width: 17px; height: 17px; fill: none; stroke: #f1eadc; stroke-width: 1.6; transition: all .2s ease; }
.cwork__fav:hover, .cwork__peek:hover { border-color: var(--gold); transform: scale(1.08); }
.cwork__peek { opacity: 0; transform: translateY(-6px); }
.cwork:hover .cwork__peek { opacity: 1; transform: none; }
.cwork__peek:hover svg { stroke: #FBAB04; }
.cwork__title a { color: inherit; transition: color .2s; }
.cwork__title a:hover { color: var(--gold-bright); }
.cwork__fav.is-fav { background: rgba(217, 161, 59, .2); border-color: var(--gold); }
.cwork__fav.is-fav svg { fill: #FBAB04; stroke: #FBAB04; }
.cwork__fav.pop { animation: favpop .4s ease; }
/* лимит выбора исчерпан — короткий отказ вместо молчаливого игнора */
.cwork__fav.is-denied { animation: favdeny .5s ease; border-color: #b4543f; }
@keyframes favdeny {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@keyframes favpop { 0%,100% { transform: scale(1); } 40% { transform: scale(1.35); } }

.cwork__overlay { position: absolute; inset: 0; z-index: 2; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 20px; opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.cwork:hover .cwork__overlay { opacity: 1; }
.cwork__view { display: inline-flex; align-items: center; gap: 10px; padding: 9px 20px; border: 1px solid var(--gold); border-radius: 999px; background: rgba(6, 7, 7, .55); backdrop-filter: blur(4px); color: #FBAB04; font-family: var(--font-head); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; transform: translateY(10px); transition: transform .3s ease; }
.cwork:hover .cwork__view { transform: none; }
.cwork__view i { width: 6px; height: 6px; transform: rotate(45deg); background: var(--gold); display: inline-block; }

.cwork__info { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 4px; }
/* path through the tree, e.g. "NEW TESTAMENT · JOHN" — each testament gets a
   slightly different warmth so the two read apart at a glance */
.cwork__cat { font-family: var(--font-head); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-muted); }
.cwork__cat--old { color: #a87d3f; }
.cwork__cat--new { color: #c9a869; }
.cwork__title { margin: 2px 0 0; color: #FBAB04; font-family: var(--font-head); font-size: 15px; letter-spacing: .03em; text-transform: uppercase; line-height: 1.3; min-height: 2.5em; }
.cwork__ref { margin: 0; color: var(--body-dim); font-size: 15px; font-style: italic; }
.cwork__nation { margin: 8px 0 0; display: flex; align-items: center; gap: 7px; color: var(--body-dim); font-family: var(--font-head); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.cwork__nation::before { content: ""; width: 16px; height: 1px; background: var(--gold-muted); }

/* empty state */
.cempty { text-align: center; padding: 40px 0 20px; color: var(--body-dim); }
.cempty p { font-size: 20px; font-style: italic; margin: 0 0 20px; }

/* ---------------- Pagination ---------------- */
.cpager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: clamp(40px, 5vw, 64px); }
.cpager button { min-width: 44px; height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-soft); border-radius: 4px; background: none; cursor: pointer; color: var(--body-text); font-family: var(--font-head); font-size: 14px; letter-spacing: .04em; transition: all .2s ease; }
.cpager button:hover:not(:disabled) { border-color: var(--gold-muted); color: #FBAB04; }
.cpager button.is-active { border-color: var(--gold); background: linear-gradient(100deg, #c98f26, #e6b652); color: #1a1206; }
.cpager button:disabled { opacity: .3; cursor: default; }
.cpager .cpager__ell { border: 0; cursor: default; color: var(--gold-deep); }
.cpager__arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* grid fade on re-render */
.cgrid.is-swapping { opacity: 0; transition: opacity .15s ease; }


/* ---------------- Quick-view modal ---------------- */
.cwmodal__dialog { width: min(1000px, 100%); text-align: left; padding: 0; overflow: hidden; }
.cwmodal__grid { display: grid; grid-template-columns: 1fr 1fr; }
.cwmodal__art { margin: 0; background: #050606; }
.cwmodal__art img { width: 100%; height: 100%; max-height: 86vh; object-fit: cover; display: block; }
.cwmodal__info { padding: clamp(28px, 3vw, 46px); align-self: center; }
.cwmodal__num { font-family: var(--font-serif); font-weight: 600; font-size: 40px; line-height: 1; color: #FBAB04; }
.cwmodal__info .cwork__cat { display: block; margin: 12px 0 4px; font-size: 11px; }
.cwmodal__title { margin: 0; color: #FBAB04; font-family: var(--font-serif); font-weight: 600; font-size: clamp(26px, 3vw, 38px); line-height: 1.1; }
.cwmodal__ref { margin: 8px 0 0; color: var(--body-dim); font-size: 18px; font-style: italic; }
.cwmodal__rule { width: 200px; margin: 18px 0 18px; }
.cwmodal__rule span:first-child { background: linear-gradient(90deg, transparent, var(--gold-muted)); }
.cwmodal__rule span:last-child { background: linear-gradient(90deg, var(--gold-muted), transparent); }
.cwmodal__desc { color: var(--body-text); font-size: 17px; line-height: 1.5; }
.cwmodal__artist { margin: 16px 0 0; color: var(--body-dim); font-size: 15px; }
.cwmodal__artist b { color: #FBAB04; font-style: italic; }
.cwmodal__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }
.cwmodal__fav.is-fav { border-color: var(--gold); background: rgba(217, 161, 59, .12); color: #FBAB04; }

/* ---------------- Filters trigger (small screens) ---------------- */
.cfab {
  display: none; position: fixed; z-index: 90; right: 24px; bottom: 24px;
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer; place-items: center;
  border: 1px solid var(--gold); background: rgba(8, 8, 7, .94); backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 0 18px rgba(217, 161, 59, .25);
  transition: transform .25s ease, box-shadow .25s ease;
}
.cfab:hover { transform: scale(1.06); }
.cfab svg { grid-area: 1 / 1; width: 22px; height: 22px; fill: none; stroke: var(--gold-bright); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; transition: opacity .2s ease, transform .25s ease; }
.cfab__close { opacity: 0; transform: rotate(-90deg); }
body.filters-open .cfab__funnel { opacity: 0; transform: rotate(90deg); }
body.filters-open .cfab__close { opacity: 1; transform: none; }
.cfab__dot { position: absolute; top: 6px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(100deg, #c98f26, #e6b652); box-shadow: 0 0 8px rgba(251, 171, 4, .8); opacity: 0; transition: opacity .2s; }
.cfab.has-filters .cfab__dot { opacity: 1; }
.cside__scrim { position: fixed; inset: 0; z-index: 80; background: rgba(3, 4, 4, .72); backdrop-filter: blur(3px); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1240px) {
  .cgrid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  /* filters slide in from the left instead of taking a column */
  .catlayout { grid-template-columns: 1fr; }
  .cfab { display: grid; }
  .cside {
    position: fixed; z-index: 85; top: 0; bottom: 0; left: 0; width: min(340px, 86vw);
    padding: 24px 20px; overflow-y: auto;
    background: rgba(8, 9, 8, .98); border-right: 1px solid var(--gold-muted);
    box-shadow: 24px 0 60px rgba(0, 0, 0, .6);
    transform: translateX(-102%); transition: transform .3s cubic-bezier(.3, .7, .2, 1);
  }
  body.filters-open .cside { transform: none; }
  .cside__inner { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .cgrid { grid-template-columns: repeat(2, 1fr); }
  .cwmodal__grid { grid-template-columns: 1fr; }
  .cwmodal__art img { max-height: 42vh; }
}
@media (max-width: 520px) {
  .cgrid { grid-template-columns: 1fr; }
  .ctools { justify-content: space-between; }
}
