/* ============================================================
   dopamine-interior.ru – страница проекта (портфолио)
   Макет: сравнение «было/стало» во всю ширину, ниже описание
   липкой колонкой и фотогалерея рядом.
   ============================================================ */

.pj { padding-top: var(--header-h); }

/* Плашка черновика – удалить перед сдачей */
.pj-draft { background: #fff5d6; border-bottom: 1px solid #f0e2ae; color: #6b5a1d; font-size: 13px; }
.pj-draft .container { display: flex; gap: 10px; align-items: flex-start; padding-block: 10px; }
.pj-draft b { color: #4d4113; }

/* ---------- Хлебные крошки ---------- */
.pj-crumbs { padding-block: 14px 10px; font-size: 13px; color: var(--muted); }
.pj-crumbs a { color: var(--muted); text-decoration: none; }
.pj-crumbs a:hover { color: var(--accent); }
.pj-crumbs span { margin-inline: 8px; opacity: .5; }

/* ---------- Шапка проекта ---------- */
.pj-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; margin-bottom: clamp(14px, 1.8vw, 22px); }
.pj-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 4.4vw, 54px); line-height: .98; letter-spacing: -.02em; margin: 0; }
.pj-head .pj-sub { margin: 10px 0 0; color: var(--ink-2); font-size: clamp(16px, 1.3vw, 19px); max-width: 52ch; }
.pj-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.pj-chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--pill); background: var(--bg-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pj-chip.is-accent { background: var(--accent); color: #fff; }

/* ---------- Сравнение «было/стало» ---------- */
.pj-compare {
  position: relative; width: 100%; overflow: hidden; border-radius: var(--radius);
  background: var(--bg-2); user-select: none; touch-action: pan-y;
  box-shadow: var(--shadow);
}
.pj-compare.is-hero { height: clamp(320px, 50vh, 600px); }
.pj-compare.is-inline { aspect-ratio: 3 / 2; }
.pj-compare picture { position: absolute; inset: 0; display: block; }
.pj-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pj-compare .pj-after { clip-path: inset(0 0 0 var(--split, 50%)); }
.pj-compare picture.pj-after img, .pj-compare picture.pj-before img { clip-path: none; }
.pj-compare .pj-line {
  position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; margin-left: -1px;
  background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(23, 22, 26, .12);
  pointer-events: none;
}
.pj-compare .pj-grip {
  position: absolute; top: 50%; left: var(--split, 50%); width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%; border: 0; cursor: ew-resize; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px -10px rgba(23, 22, 26, .55);
  transition: transform .2s var(--ease);
}
.pj-compare .pj-grip:hover { transform: scale(1.06); }
.pj-compare .pj-grip:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.pj-compare .pj-grip svg { width: 22px; height: 22px; color: var(--ink); }
.pj-compare .pj-tag {
  position: absolute; bottom: 18px; padding: 8px 14px; border-radius: var(--pill);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(23, 22, 26, .58); color: #fff; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}
.pj-compare .pj-tag-before { left: 18px; }
.pj-compare .pj-tag-after { right: 18px; background: var(--accent); }
.pj-compare .pj-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  padding: 8px 16px; border-radius: var(--pill); background: rgba(244, 244, 241, .9); color: var(--ink);
  font-size: 12px; font-weight: 600; pointer-events: none; transition: opacity .3s;
}
.pj-compare.is-touched .pj-hint { opacity: 0; }
.pj-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- Тело: описание + галерея ---------- */
.pj-body { padding-block: clamp(26px, 3.2vw, 44px) clamp(56px, 7vw, 104px); }
.pj-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.pj-aside { position: sticky; top: calc(var(--header-h) + 24px); }
.pj-aside h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.1; margin: 0 0 16px; }
.pj-aside p { color: var(--ink-2); font-size: 16px; line-height: 1.65; margin: 0 0 14px; }
.pj-aside p:last-of-type { margin-bottom: 0; }
.pj-lead { font-size: 18px !important; color: var(--ink) !important; }

.pj-facts { margin: 26px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.pj-facts li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pj-facts dt, .pj-facts .k { color: var(--muted); }
.pj-facts .v { font-weight: 700; text-align: right; }

.pj-aside .btn { margin-top: 26px; }
.pj-aside .pj-person { display: flex; align-items: center; gap: 12px; margin-top: 26px; font-size: 14px; color: var(--muted); }
.pj-aside .pj-person img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.pj-aside .pj-person b { display: block; color: var(--ink); font-size: 15px; }

/* ---------- Галерея ---------- */
.pj-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(10px, 1.2vw, 18px); }
.pj-shot { position: relative; margin: 0; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-2); cursor: zoom-in; }
.pj-shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s var(--ease); }
.pj-shot:hover img { transform: scale(1.04); }
.pj-shot.is-wide { grid-column: span 2; aspect-ratio: 16 / 10; }
.pj-shot.is-tall { aspect-ratio: 3 / 4; }
.pj-gallery-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.pj-gallery-head h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 1.8vw, 26px); margin: 0; }
.pj-gallery-head span { color: var(--muted); font-size: 14px; }

/* ---------- Вторая пара «было/стало» ---------- */
.pj-pair { background: var(--bg-2); }
.pj-pair .pj-pair-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.pj-pair h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 2.6vw, 38px); line-height: 1.08; margin: 0 0 14px; }
.pj-pair p { color: var(--ink-2); margin: 0; font-size: 16px; line-height: 1.65; }

/* ---------- Результат ---------- */
.pj-result { background: var(--dark); color: var(--on-dark); }
.pj-result .pj-result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 48px); }
.pj-result .n { font-family: var(--font-display); font-weight: 600; font-size: clamp(34px, 4.4vw, 58px); line-height: 1; color: #fff; }
.pj-result .n i { font-style: normal; color: var(--accent); }
.pj-result p { color: var(--on-dark-muted); margin: 10px 0 0; font-size: 15px; max-width: 32ch; }
.pj-result blockquote { margin: clamp(32px, 4vw, 56px) 0 0; padding-top: clamp(24px, 3vw, 40px); border-top: 1px solid rgba(244, 244, 241, .16); font-size: clamp(18px, 1.8vw, 24px); line-height: 1.45; max-width: 68ch; }
.pj-result cite { display: block; margin-top: 14px; font-style: normal; font-size: 14px; color: var(--on-dark-muted); }

/* ---------- Следующий проект ---------- */
.pj-next { position: relative; display: block; overflow: hidden; text-decoration: none; color: #fff; }
.pj-next img { width: 100%; height: clamp(260px, 38vh, 420px); object-fit: cover; display: block; transition: transform 1.2s var(--ease); }
.pj-next:hover img { transform: scale(1.05); }
.pj-next .pj-next-in { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; text-align: center; gap: 10px; background: linear-gradient(180deg, rgba(23,22,26,.35), rgba(23,22,26,.6)); }
.pj-next small { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.pj-next strong { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 3.4vw, 48px); }

/* ---------- Лайтбокс ---------- */
.pj-lb { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(12, 11, 14, .93); }
.pj-lb.is-open { display: grid; place-items: center; }
.pj-lb img { max-width: min(92vw, 1500px); max-height: 86vh; object-fit: contain; border-radius: 6px; }
.pj-lb button { position: absolute; border: 0; width: 52px; height: 52px; border-radius: 50%; background: rgba(244, 244, 241, .14); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .2s; }
.pj-lb button:hover { background: rgba(244, 244, 241, .28); }
.pj-lb button svg { width: 22px; height: 22px; }
.pj-lb .pj-lb-close { top: 24px; right: 24px; }
.pj-lb .pj-lb-prev { left: 24px; top: 50%; margin-top: -26px; }
.pj-lb .pj-lb-next { right: 24px; top: 50%; margin-top: -26px; }
.pj-lb .pj-lb-count { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); color: rgba(244, 244, 241, .7); font-size: 13px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1000px) {
  .pj-grid { grid-template-columns: 1fr; }
  .pj-aside { position: static; }
  .pj-pair .pj-pair-grid { grid-template-columns: 1fr; }
  .pj-result .pj-result-grid { grid-template-columns: 1fr; gap: 28px; }
  .pj-head { grid-template-columns: 1fr; align-items: start; }
  .pj-chips { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .pj-compare.is-hero { height: clamp(380px, 56vh, 520px); }
  .pj-compare.is-inline { aspect-ratio: 4 / 5; }
  .pj-compare .pj-hint { display: none; }
  .pj-compare .pj-tag { bottom: 12px; padding: 6px 11px; font-size: 11px; }
  .pj-compare .pj-tag-before { left: 12px; }
  .pj-compare .pj-tag-after { right: 12px; }
  .pj-compare .pj-grip { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  .pj-gallery { grid-template-columns: 1fr; }
  .pj-shot.is-wide, .pj-shot.is-tall { grid-column: auto; aspect-ratio: 4 / 3; }
  .pj-lb .pj-lb-prev { left: 10px; }
  .pj-lb .pj-lb-next { right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .pj-shot img, .pj-next img { transition: none; }
}

/* ---------- Узкая полоса с кнопкой брифа ---------- */
.pj-cta { position: relative; overflow: hidden; background: var(--card); }
.pj-cta::before, .pj-cta::after {
  content: ''; position: absolute; left: 0; right: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, rgba(23, 22, 26, .28), rgba(23, 22, 26, .62) 50%, rgba(23, 22, 26, .28));
}
.pj-cta::before { top: 0; }
.pj-cta::after { bottom: 0; }
/* Огоньки: сверху бежит слева направо, снизу справа налево */
.pj-spark {
  position: absolute; height: 6px; width: 340px; pointer-events: none; z-index: 1;
  background: radial-gradient(closest-side, rgba(255, 248, 244, .95) 0%, rgba(228, 85, 44, .85) 30%, rgba(228, 85, 44, .3) 62%, rgba(228, 85, 44, 0) 100%);
  filter: blur(1.4px);
}
.pj-spark-top { top: -3px; left: 0; animation: pj-run-right 4.6s linear infinite; }
.pj-spark-bottom { bottom: -3px; right: 0; animation: pj-run-left 4.6s linear infinite; animation-delay: -2.3s; }
@keyframes pj-run-right {
  0% { transform: translateX(-230px); opacity: 0; }
  14% { opacity: 1; }
  82% { opacity: 1; }
  100% { transform: translateX(calc(100vw + 230px)); opacity: 0; }
}
@keyframes pj-run-left {
  0% { transform: translateX(230px); opacity: 0; }
  14% { opacity: 1; }
  82% { opacity: 1; }
  100% { transform: translateX(calc(-100vw - 230px)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .pj-spark { animation: none; opacity: .6; } }
.pj-cta .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 14px; }
.pj-cta p { margin: 0; font-size: clamp(16px, 1.22vw, 17.6px); line-height: 1.4; color: var(--ink-2); text-transform: uppercase; letter-spacing: .015em; font-weight: 500; }
.pj-cta p b { color: var(--ink); }
.pj-cta .btn { flex: 0 0 auto; padding-block: 11px; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Вопросы ---------- */
.pj-faq { padding-block: clamp(52px, 6vw, 88px); }
.pj-faq .section-head { margin-bottom: clamp(24px, 3vw, 40px); }
.pj-faq .section-head h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 3vw, 42px); line-height: 1.06; margin: 0; }
.pj-faq .faq { margin: 0 auto; }

@media (max-width: 720px) {
  .pj-cta .container { flex-direction: column; align-items: flex-start; gap: 14px; }
  .pj-cta .btn { width: 100%; justify-content: center; }
}

/* Ритм галереи, когда классы кадрам не проставлены (вывод через Gallery на MODX) */
.pj-gallery > .pj-shot:not(.is-wide):not(.is-tall) { aspect-ratio: 3 / 4; }
.pj-gallery > .pj-shot:not(.is-wide):not(.is-tall):nth-child(7n + 1) { grid-column: span 2; aspect-ratio: 16 / 10; }
@media (max-width: 640px) {
  .pj-gallery > .pj-shot:not(.is-wide):not(.is-tall):nth-child(7n + 1) { grid-column: auto; aspect-ratio: 4 / 3; }
}

/* Пометка чернового текста в описании проекта — удалить, когда текст заменят */
.pj-aside .pj-draft-note { margin-top: 14px; font-size: 13px; color: #a08327; background: #fff8e1; border-radius: 10px; padding: 8px 12px; }
