/* ============================================================
   /proekti — портфолио от реални снимки (само на тази страница)
   Генерира се от client-photos/build-proekti.mjs; JS: js/projects.js
   Тъмна страница (мастило); апартаментът е светъл „лист“ хартия.
   ============================================================ */

/* резервира мястото на скролбара → лайтбоксът заключва скрола без подскок */
html { scrollbar-gutter: stable; }
html.pj-lock { overflow: hidden; }

.pj-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.pj-page [hidden] { display: none !important; }
/* текст само със/без projects.js (плъзгачът без JS е неподвижен 50/50 → „влачете“ би излъгало) */
.pj-page:not(.pj-js) .pj-js-only, .pj-page.pj-js .pj-nojs-only { display: none !important; }

/* ---------- хиро ---------- */
.pj-hero { min-height: clamp(560px, 100svh, 940px); }
.pj-hero .page-hero__img { object-position: 52% 58%; }
.pj-hero .page-hero__veil {
  background:
    linear-gradient(90deg, rgba(22,19,15,.62) 0%, rgba(22,19,15,.18) 62%, rgba(22,19,15,0) 100%),
    linear-gradient(180deg, rgba(22,19,15,.55) 0%, rgba(22,19,15,.08) 34%, rgba(22,19,15,.35) 62%, rgba(22,19,15,.94) 100%);
}
.pj-hero .page-hero__inner { max-width: 1240px; padding-bottom: 64px; }
.pj-hero .page-hero__lede { max-width: 600px; }
.pj-hero__facts {
  list-style: none; display: flex; flex-wrap: wrap; gap: 14px 0; margin: 34px 0 0; padding: 0;
}
.pj-hero__facts li { display: flex; align-items: center; gap: 12px; padding-right: 28px; }
.pj-hero__facts li + li { padding-left: 28px; border-left: 1px solid rgba(241,236,227,.22); }
.pj-hero__facts strong {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1; color: var(--gold-soft); letter-spacing: -.01em;
}
.pj-hero__facts span { font-size: 13.5px; font-weight: 600; color: rgba(241,236,227,.82); max-width: 12ch; line-height: 1.3; }
.pj-hero__note {
  display: flex; align-items: center; gap: 12px; margin-top: 26px;
  font-size: 13.5px; line-height: 1.5; color: rgba(241,236,227,.78);
}
.pj-hero__note::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 5px rgba(217,164,65,.18);
}
@media (prefers-reduced-motion: no-preference) {
  html.js .pj-hero__facts { animation: pjUp .9s .55s cubic-bezier(.2,.7,.2,1) both; }
  html.js .pj-hero__note { animation: pjUp .9s .75s cubic-bezier(.2,.7,.2,1) both; }
}
@keyframes pjUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- увод ---------- */
.pj-intro { padding-bottom: 36px; }
.pj-intro .section-head { text-align: center; }
.pj-intro .section-head__lede { margin-inline: auto; max-width: 640px; }

/* ---------- филтър (лепкав под навигацията) ---------- */
.pj-list { position: relative; }
.pj-filter {
  position: sticky; top: 70px; z-index: 30;
  display: flex; justify-content: center; padding: 10px 24px 14px;
  pointer-events: none;
}
.pj-page:not(.pj-js) .pj-filter { visibility: hidden; } /* без projects.js бутоните нямат смисъл; място пазим → без подскок */
/* при скрол надолу лентата се прибира под навигацията, при скрол нагоре се връща (projects.js) */
.pj-filter { transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .35s, visibility 0s 0s; }
.pj-filter.is-tucked { transform: translateY(-120%); opacity: 0; visibility: hidden; transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .3s, visibility 0s .5s; }
@media (prefers-reduced-motion: reduce) { .pj-filter, .pj-filter.is-tucked { transition: none; } }
.pj-filter__list {
  pointer-events: auto; display: flex; gap: 4px; padding: 5px; max-width: 100%;
  border-radius: 99px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  background: color-mix(in srgb, var(--ink) 84%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(241,236,227,.12);
  box-shadow: 0 22px 44px -26px rgba(0,0,0,.7);
}
.pj-filter__list::-webkit-scrollbar { display: none; }
.pj-chip {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 42px; padding: 0 17px; border-radius: 99px;
  font: 700 13.5px/1 var(--font-body); letter-spacing: .01em; white-space: nowrap;
  color: rgba(241,236,227,.72);
  transition: background .3s, color .3s;
}
.pj-chip:hover { color: var(--paper); background: rgba(241,236,227,.07); }
.pj-chip__n {
  font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  display: inline-grid; place-items: center; background: rgba(241,236,227,.1); color: inherit;
}
.pj-chip[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.pj-chip[aria-pressed="true"] .pj-chip__n { background: rgba(22,19,15,.14); }
.pj-chip:focus-visible { outline-offset: -2px; border-radius: 99px; }

/* ---------- проектите ---------- */
.pj, .pj-pair, .pjba { position: relative; scroll-margin-top: 140px; }
.pj { padding: 96px 24px 104px; }
.pj__wrap { max-width: 1240px; margin: 0 auto; }
.pj--ink { border-top: 1px solid rgba(241,236,227,.08); }
.pj--ink:first-of-type, .pj--star + .pj--ink { border-top-color: transparent; }

.pj__head {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 18px 48px; align-items: start; margin-bottom: 44px;
}
.pj__num {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(52px, 6vw, 84px);
  line-height: .86; letter-spacing: -.03em;
  color: transparent; -webkit-text-stroke: 1.2px rgba(217,164,65,.75);
}
.pj__cat {
  font-size: 12px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 14px;
}
.pj__title {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 3.3vw, 44px);
  line-height: 1.14; color: var(--paper); text-wrap: balance;
}
.pj__title em { font-family: var(--font-story); font-style: italic; font-weight: 600; color: var(--gold-soft); }
.pj__sum { margin-top: 18px; max-width: 640px; font-size: 16.5px; line-height: 1.7; color: var(--muted-on-dark); }
.pj__count {
  align-self: end; white-space: nowrap; font-size: 13px; font-weight: 700; letter-spacing: .06em;
  color: rgba(241,236,227,.75); padding: 10px 18px; border-radius: 99px;
  border: 1px solid rgba(241,236,227,.16);
}

/* под-заглавия на галериите („Преди ремонта · 8 снимки“) */
.pj-sub { display: flex; align-items: baseline; gap: 16px; margin: 56px 0 18px; }
.pj__head + .pj-sub { margin-top: 0; }
.pj-sub__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(19px, 2vw, 24px); color: var(--paper); }
.pj-sub__n { margin-left: .2em; font-family: var(--font-body); font-size: 13.5px; font-weight: 600; letter-spacing: .01em; color: var(--muted-on-dark); white-space: nowrap; }
.pj-sub::after { content: ""; flex: 1; height: 1px; background: rgba(241,236,227,.12); align-self: center; }

/* ---------- галерия: балансирани редове (генераторът ги разпределя) ----------
   В реда всяка клетка расте ∝ пропорцията си (--r) от основа 0 → равна височина и точно цяла ширина,
   без JS и без подскок. Твърде къс ред (малко снимки) не се разтяга над --maxh на височина. */
.pj-gal { --gap: 10px; --maxh: 520px; container-type: inline-size; }
.pj-grid { display: grid; gap: var(--gap); }
.pj-row { display: flex; gap: var(--gap); max-width: calc(var(--sum) * var(--maxh) + (var(--n) - 1) * var(--gap)); }
.pj-cell { flex: var(--r) 1 0; min-width: 0; }
.pj-cell .pj-tile { aspect-ratio: var(--r); container-type: inline-size; }
/* етикетът „В процес / Готово“ — един размер в цялата галерия (на телефон — по-дребният, вж. долу);
   генераторът не допуска плочки под ~120px на телефон, скриването е само предпазна мрежа */
.pj-pair__tag { white-space: nowrap; }
@container (max-width: 100px) { .pj-cell .pj-pair__tag { display: none; } }
.pj-tile {
  position: relative; display: block; overflow: hidden; border-radius: 14px;
  background: #2a251d; isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.pj-tile img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 1s cubic-bezier(.2,.7,.2,1), filter .5s;
}
.pj-tile__cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 36px 16px 13px; font-size: 13px; line-height: 1.4; font-weight: 600; color: #f6f2ea;
  background: linear-gradient(180deg, transparent, rgba(12,10,7,.82));
  opacity: 0; transform: translateY(10px); transition: opacity .35s, transform .45s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}
.pj-tile::after {
  content: ""; position: absolute; top: 12px; right: 12px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(246,242,234,.92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316130f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7'/%3E%3C/svg%3E") center / 16px no-repeat;
  opacity: 0; transform: scale(.8); transition: opacity .3s, transform .4s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}
@media (hover: hover) {
  .pj-tile:hover img { transform: scale(1.05); }
  .pj-tile:hover .pj-tile__cap, .pj-tile:focus-visible .pj-tile__cap { opacity: 1; transform: none; }
  .pj-tile:hover::after, .pj-tile:focus-visible::after { opacity: 1; transform: none; }
}
.pj-tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 14px; }

/* ---------- звездата: апартаментът (светъл лист) ---------- */
.pj--star {
  background: var(--paper); color: var(--text-on-light);
  margin: 8px clamp(8px, 1.6vw, 24px) 0; border-radius: clamp(22px, 3vw, 44px);
  padding-top: 88px;
  box-shadow: 0 -30px 80px -60px rgba(217,164,65,.35);
}
.pj--star .pj__num { -webkit-text-stroke-color: rgba(168,122,36,.8); }
/* дребен златен текст върху хартия: --gold-deep е ~3,4:1 → за 12px главни ползваме по-тъмно злато (~4,8:1, AA) */
.pj--star { --pj-gold-text: #8a6418; }
.pj--star .pj__cat { color: var(--pj-gold-text); }
.pj--star .pj__title { color: var(--text-on-light); }
.pj--star .pj__title em { color: var(--gold-deep); }
.pj--star .pj__sum { color: var(--muted-on-light); }
.pj--star .pj__count { color: var(--text-on-light); border-color: rgba(36,31,24,.18); }
.pj--star .pj-sub__title { color: var(--text-on-light); }
.pj--star .pj-sub__n { color: var(--muted-on-light); }
.pj--star .pj-sub::after { background: rgba(36,31,24,.12); }
.pj--star .pj-tile { background: #e6dfd2; }
.pj--star .pj-tile:focus-visible { outline-color: var(--gold-deep); }

.pj-star {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(36px, 5vw, 84px); align-items: center;
}

/* плъзгач преди/след (кухнята — единствената подравнена двойка) */
.pjba { --pos: 50%; }
.pjba__frame {
  position: relative; margin-inline: auto; aspect-ratio: 3 / 4;
  width: min(100%, calc(min(80svh, 760px) * 3 / 4));
  border-radius: 26px; overflow: hidden; overflow: clip; background: #d8cfc0; /* clip: never scrolls to a focused handle at 100% */
  box-shadow: 0 60px 110px -60px rgba(60,40,10,.6), 0 2px 0 rgba(255,255,255,.6) inset;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: ew-resize;
}
.pjba__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pjba__before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); will-change: clip-path; }
.pjba__label {
  position: absolute; top: 18px; z-index: 3; pointer-events: none;
  font-size: 11.5px; font-weight: 800; letter-spacing: .26em; text-transform: uppercase;
  padding: 8px 14px; border-radius: 99px;
}
.pjba__label--before { left: 18px; background: rgba(15,12,8,.7); color: var(--paper); }
.pjba__label--after { right: 18px; background: rgba(255,255,255,.86); color: var(--text-on-light); }
/* the handle and the "drag" hint ride on a layer exactly as wide as the frame, moved with transform: translateX(50%)
   = half the frame. A transform is not a layout change → the automatic hint animation adds nothing to CLS (left: var(--pos)
   did: 0.04–0.06 on phones). The clip-path of the "before" layer was never a layout shift. */
.pjba__rail {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  transform: translate3d(var(--pos), 0, 0); will-change: transform;
}
.pjba__handle {
  position: absolute; top: 0; bottom: 0; left: 0; z-index: 4;
  width: 56px; margin-left: -28px; display: grid; place-items: center; pointer-events: auto;
  color: var(--ink); cursor: ew-resize; outline: none;
}
.pjba__handle::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px;
  background: var(--gold); box-shadow: 0 0 0 1px rgba(22,19,15,.08), 0 0 24px rgba(217,164,65,.6);
}
.pjba__handle i {
  position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); box-shadow: 0 10px 28px -8px rgba(0,0,0,.55), 0 0 0 6px rgba(217,164,65,.22);
  transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s;
}
.pjba__frame:hover .pjba__handle i, .pjba.is-drag .pjba__handle i { transform: scale(1.08); }
/* фокусът се показва на копчето, не като рамка около цялата височина (глобалното [tabindex]:focus-visible) */
.pjba__handle:focus-visible { outline: none; }
.pjba__handle:focus-visible i { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink); }
.pj-page:not(.pj-js) .pjba__handle i { display: none; }
.pjba__hint {
  position: absolute; left: 0; bottom: 22px; z-index: 3; transform: translateX(-50%);
  font-size: 11px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase;
  color: var(--paper); background: rgba(15,12,8,.62); padding: 7px 12px; border-radius: 99px;
  pointer-events: none; transition: opacity .4s;
}
.pjba.is-touched .pjba__hint:not(.pjba__hint--static) { opacity: 0; }
/* без JS: неподвижна половин/половин снимка, обяснена с думи */
.pj-page:not(.pj-js) .pjba__frame { cursor: default; }
.pjba__hint--static {
  left: 50%; width: max-content; max-width: calc(100% - 28px); text-align: center; white-space: normal;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: none; line-height: 1.35; padding: 8px 14px;
  z-index: 5; border-radius: 14px; background: rgba(15,12,8,.78); /* над златната линия на разделението */
}
/* двете реални снимки на кухнята в цял размер (влизат в лайтбокса на апартамента) */
.pjba__open {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  margin: 16px auto 0; font-size: 13.5px; font-weight: 600; color: var(--muted-on-light);
}
.pjba__link {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: 99px;
  border: 1px solid rgba(36,31,24,.2); color: var(--text-on-light); font-weight: 700;
  transition: border-color .25s, color .25s, background .25s;
}
.pjba__link::after {
  content: ""; width: 12px; height: 12px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23000%27 stroke-width=%272.6%27 stroke-linecap=%27round%27%3E%3Cpath d=%27M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7%27/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23000%27 stroke-width=%272.6%27 stroke-linecap=%27round%27%3E%3Cpath d=%27M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7%27/%3E%3C/svg%3E") center / contain no-repeat;
}
.pjba__link:hover { border-color: var(--gold-deep); color: var(--pj-gold-text, var(--gold-deep)); }
.pjba__link:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; }

.pj-kicker { font-size: 12px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--pj-gold-text, var(--gold-deep)); }
.pj-star__title {
  margin-top: 16px; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(26px, 3vw, 40px); line-height: 1.15; color: var(--text-on-light);
}
.pj-star__title em { font-family: var(--font-story); font-style: italic; color: var(--gold-deep); }
.pj-star__p { margin-top: 18px; font-size: 16.5px; line-height: 1.7; color: var(--muted-on-light); max-width: 520px; }
.pj-works__title {
  margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(36,31,24,.12);
  font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--text-on-light);
}
.pj-works { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 11px; }
.pj-works li { position: relative; padding-left: 26px; font-size: 15.5px; line-height: 1.55; color: var(--text-on-light); }
.pj-works li::before {
  content: ""; position: absolute; left: 2px; top: .62em; width: 12px; height: 7px;
  border-left: 2px solid var(--gold-deep); border-bottom: 2px solid var(--gold-deep);
  transform: translateY(-50%) rotate(-45deg);
}
.pj-works__note { margin-top: 16px; font-size: 13.5px; font-style: italic; color: var(--muted-on-light); }

/* още три стаи — една до друга (не са подравнени → без плъзгач) */
.pj-pairs-head { margin-top: 96px; max-width: 720px; }
.pj-pairs-head__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 2.6vw, 32px); line-height: 1.2; color: var(--text-on-light); }
.pj-pairs-head__title em { font-family: var(--font-story); font-style: italic; color: var(--gold-deep); }
.pj-pairs-head__p { margin-top: 12px; font-size: 15.5px; line-height: 1.65; color: var(--muted-on-light); }
.pj-pairs { list-style: none; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.pj-pair__imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 18px; overflow: hidden; }
.pj-pair__half { aspect-ratio: 3 / 4; border-radius: 0; }
.pj-pair__tag {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  font-size: 10.5px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase;
  padding: 6px 10px; border-radius: 99px;
}
.pj-pair__tag--before { background: rgba(15,12,8,.72); color: var(--paper); }
.pj-pair__tag--after { background: rgba(255,255,255,.9); color: var(--text-on-light); }
.pj-pair__half::after { top: 10px; right: 10px; width: 30px; height: 30px; }
.pj-pair__room { margin-top: 14px; font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--text-on-light); }
.pj-pair .pj-tile__cap { display: none; }

/* ---------- покана след апартамента („Искате същото за вашия дом?“) ---------- */
.pj-ask {
  margin-top: 72px; padding: clamp(26px, 3.6vw, 44px) clamp(22px, 4vw, 52px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px 40px;
  border-radius: 24px; background: #eee6d7; border: 1px solid rgba(36,31,24,.08);
}
.pj-ask__text { flex: 1 1 340px; min-width: 0; }
.pj-ask__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 2.6vw, 32px); line-height: 1.2; color: var(--text-on-light); text-wrap: balance; }
.pj-ask__title em { font-family: var(--font-story); font-style: italic; color: var(--pj-gold-text, var(--gold-deep)); }
.pj-ask__p { margin-top: 10px; font-size: 15.5px; line-height: 1.6; color: #5f584c; } /* ≈5,7:1 върху #eee6d7 (--muted-on-light е само 4,5:1) */
.pj-ask__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pj-ask__actions .btn { margin-top: 0; }
.pj-ask__tel { display: inline-flex; align-items: center; gap: 9px; }
.pj-ask .btn:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 3px; }

/* ---------- знаковият проект (само текст — не е свързан с конкретна снимка) ---------- */
.pj-story {
  position: relative; text-align: center; padding: 130px 24px 120px;
  border-top: 1px solid rgba(241,236,227,.08);
  background: radial-gradient(60% 70% at 50% 0%, rgba(217,164,65,.09), transparent 70%);
}
.pj-story__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .34em; text-transform: uppercase; color: var(--gold); }
.pj-story__text {
  margin: 26px auto 0; max-width: 900px;
  font-family: var(--font-story); font-style: italic; font-weight: 500;
  font-size: clamp(22px, 3.1vw, 38px); line-height: 1.42; color: var(--paper); text-wrap: balance;
}
.pj-story__text em { color: var(--gold-soft); }
.pj-story__more { margin: 26px auto 0; max-width: 600px; font-size: 16.5px; line-height: 1.7; color: var(--muted-on-dark); }

/* ---------- процесът: портретна реална снимка ---------- */
.pj-process .p-media { aspect-ratio: 4 / 5; width: min(100%, 470px); margin-inline: auto; }

/* ---------- CTA: два бутона ---------- */
.pj-cta__actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 14px; margin-top: 36px; }
.cta-band .pj-cta__actions .btn { margin-top: 0; }

/* ---------- лайтбокс ---------- */
.lb {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(13,11,8,.97); color: var(--paper);
  touch-action: pan-y pinch-zoom;
}
/* една колона с ширината на екрана (без шаблон колоната расте до естествената ширина на снимката → бутонът
   „Затвори“ излиза извън телефона); редовете са по съдържание и центрирани → надписът е точно под снимката */
.lb[open] {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto;
  align-content: center; align-content: safe center;
}
.lb__top, .lb__stage, .lb__cap { min-width: 0; }
.lb::backdrop { background: rgba(0,0,0,.7); }
.lb__top {
  display: flex; align-items: center; gap: 16px;
  padding: max(12px, env(safe-area-inset-top)) clamp(14px, 3vw, 28px) 12px;
}
.lb__count { flex: none; min-width: 70px; font: 700 13px/1 var(--font-body); letter-spacing: .14em; color: var(--gold-soft); }
.lb__count i { font-style: normal; margin: 0 6px; color: rgba(241,236,227,.4); }
.lb__proj {
  flex: 1; min-width: 0; text-align: center; font-size: 14px; font-weight: 600; color: rgba(241,236,227,.72);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb__btn {
  appearance: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; flex: none;
  border: 1px solid rgba(241,236,227,.22); background: rgba(22,19,15,.55); color: var(--paper); cursor: pointer;
  transition: background .25s, border-color .25s, color .25s;
}
.lb__btn:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.lb__btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 50%; }
.lb__stage {
  position: relative; display: grid; place-items: center; min-height: 0;
  padding: 0 clamp(10px, 6vw, 96px); touch-action: pan-y pinch-zoom;
}
.lb__img {
  display: block; width: auto; height: auto; max-width: 100%;
  /* --lb-chrome = горната лента + надписът под снимката (projects.js ги мери при всяка снимка) */
  max-height: calc(100svh - var(--lb-chrome, 168px)); border-radius: 8px; object-fit: contain;
  box-shadow: 0 40px 100px -40px rgba(0,0,0,.9);
  transition: filter .45s, opacity .3s;
  user-select: none; -webkit-user-drag: none;
}
.lb__img.is-low { filter: blur(10px) saturate(.9); }
.lb__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb__nav--prev { left: clamp(10px, 2vw, 28px); }
.lb__nav--next { right: clamp(10px, 2vw, 28px); }
.lb__cap {
  min-height: 72px; padding: 14px clamp(16px, 4vw, 40px) max(20px, env(safe-area-inset-bottom));
  text-align: center; font-size: 15px; line-height: 1.5; color: rgba(241,236,227,.9);
  width: 100%; max-width: 880px; margin: 0 auto; overflow-wrap: anywhere;
}
.lb__tag {
  display: inline-block; vertical-align: 1px; margin-right: 10px; padding: 5px 10px; border-radius: 99px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase;
  background: var(--gold); color: var(--ink);
}
.lb__tag--light { background: var(--paper); }
@media (prefers-reduced-motion: no-preference) {
  .lb[open] { animation: pjFade .3s ease both; }
  .lb[open] .lb__img { animation: pjZoom .45s cubic-bezier(.2,.7,.2,1) both; }
}
@keyframes pjFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pjZoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- поява при скрол (класът pj-anim идва от JS, само с движение) ---------- */
.pj-anim .pj-reveal {
  transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
}
.pj-anim .pj-reveal:not(.is-in) { opacity: 0; transform: translateY(28px); }

/* ============================================================
   Отзивчивост
   ============================================================ */
/* телефони: десктопните редове се разтварят (display: contents) и клетките минават на втора, телефонна
   подредба от генератора: --pw = дял от реда, --pn = снимки в реда → всеки ред е точно цяла ширина,
   снимките са в естествената си пропорция (без изрязване, без дупки) */
@media (max-width: 699px) {
  .pj-gal { --gap: 6px; }
  .pj-grid { display: flex; flex-wrap: wrap; gap: var(--gap); }
  .pj-row { display: contents; }
  .pj-cell { flex: 0 0 auto; width: calc((100% - (var(--pn) - 1) * var(--gap)) * var(--pw) - .34px); }
}

@media (max-width: 1119px) {
  .pj-pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pj-pairs > :last-child:nth-child(odd) { grid-column: 1 / -1; max-width: calc(50% - 12px); }
}

@media (max-width: 960px) {
  .pj__head { grid-template-columns: minmax(0, 1fr) auto; }
  .pj__num { grid-column: 1 / -1; font-size: 54px; }
  .pj__intro { grid-column: 1 / -1; }
  .pj__count { grid-column: 1 / -1; justify-self: start; }
  .pj-star { grid-template-columns: 1fr; }
  .pj-star__copy { max-width: 620px; }
}

@media (max-width: 860px) {
  .pj { padding: 76px 24px 84px; }
  .pj--star { padding-top: 72px; }
  .pj-filter { top: 64px; }
  .pj-story { padding: 96px 24px 88px; }
}

@media (max-width: 760px) {
  .pj-pairs { grid-template-columns: 1fr; gap: 28px; }
  .pj-pairs > :last-child:nth-child(odd) { max-width: none; }
  .pj-pairs-head { margin-top: 72px; }
}

@media (max-width: 600px) {
  .pj-hero { min-height: clamp(560px, 92svh, 760px); }
  .pj-hero .page-hero__img { object-position: 56% 50%; }
  .pj-hero .page-hero__veil {
    background: linear-gradient(180deg, rgba(22,19,15,.6) 0%, rgba(22,19,15,.2) 26%, rgba(22,19,15,.55) 52%, rgba(22,19,15,.95) 100%);
  }
  .pj-hero .page-hero__inner { padding-bottom: 40px; }
  .pj-hero__facts { margin-top: 24px; flex-wrap: nowrap; }
  .pj-hero__facts li { flex-direction: column; align-items: flex-start; gap: 6px; padding-right: 14px; flex: 1 1 0; min-width: 0; }
  .pj-hero__facts li + li { padding-left: 14px; }
  .pj-hero__facts strong { font-size: 28px; }
  .pj-hero__facts span { font-size: 12.5px; }
  .pj-hero__note { margin-top: 20px; font-size: 13px; align-items: flex-start; }
  .pj-hero__note::before { margin-top: 6px; }

  .pj-intro { padding-bottom: 20px; }
  .pj-filter { top: 62px; padding: 8px 12px 12px; }
  .pj-filter__list {
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .pj-filter__list.is-end { -webkit-mask-image: none; mask-image: none; }
  .pj-chip { min-height: 44px; padding: 0 14px; font-size: 13px; }

  .pj { padding: 60px 20px 68px; }
  .pj--star { margin-inline: 8px; padding: 60px 16px 64px; border-radius: 24px; }
  .pj__head { gap: 12px 16px; margin-bottom: 30px; }
  .pj__num { font-size: 44px; }
  .pj__cat { margin-bottom: 10px; font-size: 11px; }
  .pj__title { font-size: clamp(22px, 6.6vw, 28px); }
  .pj__title:lang(bg), .pj__title:lang(ru) { font-size: clamp(20px, 6.1vw, 28px); }
  .pj__sum { margin-top: 12px; font-size: 15.5px; }
  .pj-sub { margin: 40px 0 14px; }
  .pj-sub::after { display: none; }
  .pj-sub__title { font-size: 18px; }
  .pj-sub__n { font-size: 13px; }

  .pj-tile { border-radius: 10px; }
  .pj-tile::after { display: none; }
  /* галерии на телефон: един размер на етикета „В процес / Готово“ за всички плочки */
  .pj-cell .pj-pair__tag { left: 7px; bottom: 7px; font-size: 9px; letter-spacing: .12em; padding: 4px 8px; }
  .pj-ask { margin-top: 56px; border-radius: 20px; }
  .pj-ask__actions { width: 100%; }
  .pj-ask__actions .btn { flex: 1 1 auto; text-align: center; justify-content: center; padding-inline: 22px; }

  .pjba__frame { border-radius: 20px; width: min(100%, calc(72svh * 3 / 4)); }
  .pjba__label { top: 12px; font-size: 10.5px; padding: 7px 11px; }
  .pjba__label--before { left: 12px; }
  .pjba__label--after { right: 12px; }
  .pjba__handle i { width: 46px; height: 46px; }
  .pj-star__p { font-size: 15.5px; }
  .pj-works li { font-size: 15px; }

  .pj-story { padding: 80px 24px 72px; }
  .pj-story__text { font-size: clamp(20px, 5.6vw, 24px); }
  .pj-story__more { font-size: 15.5px; }

  .lb__img { max-height: calc(100svh - var(--lb-chrome, 190px)); border-radius: 4px; }
  .lb__top { gap: 10px; }
  .lb__count { min-width: 0; }
  .lb__stage { padding: 0 6px; }
  .lb__nav { top: auto; bottom: -62px; transform: none; width: 44px; height: 44px; }
  .lb__nav--prev { left: 14px; }
  .lb__nav--next { right: 14px; }
  .lb__cap { padding-inline: 70px; font-size: 14px; min-height: 84px; }
}

@media (max-width: 380px) {
  .pj-hero__facts li { padding-right: 10px; }
  .pj-hero__facts li + li { padding-left: 10px; }
  .pj-hero__facts strong { font-size: 25px; }
}

/* ---------- без движение: всичко статично и четимо ---------- */
@media (prefers-reduced-motion: reduce) {
  .pj-tile img, .pj-tile__cap, .pj-tile::after, .pjba__handle i, .lb__img { transition: none; }
  .pj-tile:hover img { transform: none; }
}

/* ---------- печат ---------- */
@media print {
  .pj-filter, .lb, .pjba__handle, .pjba__hint { display: none !important; }
  .pj, .pj--star, .pj-story { background: #fff !important; color: #241f18 !important; }
  .pj__title, .pj-story__text { color: #241f18 !important; }
}
