/* =========================================================
   Портфолио по видам работ
   ========================================================= */

:root {
  --accent: #FF6B1A;
  --accent-hover: #FF8A45;
  --bg: #0c0c0e;
  --surface: #151517;
  --surface-2: #1b1b1e;
  --text: #F4F2EE;
  --text-2: #D6D2CB;
  --text-3: #BDB8B0;
  --text-4: #8E8981;
  --line: rgba(255, 255, 255, 0.1);
  --line-2: rgba(255, 255, 255, 0.22);
  --on-accent: #141414;

  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 10px;
  --radius-card: 18px;
  --pad-x: 64px;
  --max: 1440px;
  --header-h: 59px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Шапка ---------- */

.header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 12px var(--pad-x);
  background: rgba(12,12,14,.92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo svg { color: var(--accent); flex-shrink: 0; }
.logo__text { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: .02em; }
.nav { display: flex; gap: 28px; font-size: 14px; font-weight: 500; color: var(--text-3); }
.nav .is-current { color: var(--accent); }
.header__right { display: flex; align-items: center; gap: 20px; }
.header__phone { font-size: 15px; font-weight: 700; }

/* ---------- Первый экран ---------- */

.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero__bg { position: absolute; inset: 0; z-index: -1; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; }
.hero__bg::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,12,.72) 0%, rgba(10,10,12,.86) 55%, var(--bg) 100%);
}
.hero__in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 44px var(--pad-x) 36px;
  display: flex; flex-direction: column; gap: 14px;
}
.kicker {
  margin: 0;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-2);
}
.kicker__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hero__title {
  margin: 0;
  max-width: 880px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.hero__lead { margin: 0; max-width: 680px; font-size: 17px; line-height: 1.55; color: var(--text-2); }

/* ---------- Вкладки видов работ ---------- */

.tabs {
  position: sticky; top: var(--header-h); z-index: 20;
  display: flex; gap: 8px;
  padding: 12px var(--pad-x);
  overflow-x: auto;
  background: rgba(12,12,14,.92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.tab {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: 600 14px var(--font-body);
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.tab:hover { border-color: rgba(255,255,255,.4); }
.tab__num { font-size: 12px; font-weight: 700; color: var(--text-4); }
.tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab.is-active .tab__num { color: rgba(20,20,20,.65); }

/* страница одной услуги: панель видов работ скрыта */
.tabs[hidden] { display: none; }
body.is-single .page { padding-top: 34px; }

/* ---------- Работы ---------- */

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--pad-x) 72px;
  display: flex; flex-direction: column; gap: 18px;
}

.head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.head__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.head__count { margin: 0; font-size: 14px; color: var(--text-4); }

.works {
  margin: 0; padding: 0; list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.work {
  position: relative;
  display: flex; flex-direction: column;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .2s, background .2s, transform .2s;
}
.work:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateY(-3px); }
.work:focus-within { border-color: var(--accent); }

.work__open {
  position: absolute; inset: 0; z-index: 2;
  border: 0; background: none; cursor: pointer;
}
.work__open:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

.work__photo { position: relative; height: 200px; flex-shrink: 0; overflow: hidden; background: #131315; }
.work__photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.work:hover .work__photo img { transform: scale(1.04); }
.work__photo::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,12,.1) 0%, rgba(21,21,23,.85) 100%);
}
.work__mark {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 44px; font-weight: 600;
  color: rgba(255,107,26,.5);
  background: radial-gradient(120% 100% at 30% 0%, rgba(255,107,26,.16) 0%, rgba(255,107,26,0) 60%), #131315;
}

.work__body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 16px 20px 20px; }
.work__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.25; }
.work__note {
  margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.work__meta { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.work__meta div { display: flex; flex-direction: column; gap: 2px; }
.work__meta dt { font-size: 11px; font-weight: 600; color: var(--text-4); }
.work__meta dd { margin: 0; font-size: 13px; font-weight: 600; }

.tags { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  font-size: 12px; font-weight: 600; color: var(--text-4);
}

.empty {
  grid-column: 1 / -1;
  padding: 40px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-card);
  text-align: center;
  color: var(--text-3);
}

/* ---------- Призыв оставить заявку ---------- */

.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  margin-top: 10px;
  padding: 22px 26px;
  border-radius: var(--radius-card);
  border: 1px solid rgba(255,107,26,.35);
  background: rgba(255,107,26,.08);
}
.cta__title { margin: 0 0 6px; font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.25; }
.cta__text { margin: 0; font-size: 15px; color: var(--text-2); }

.note { margin: 0; font-size: 13px; color: var(--text-4); }
.note code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-3); }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px; padding: 0 22px;
  border: 0; border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  font: 700 14px var(--font-body);
  white-space: nowrap; cursor: pointer;
  transition: filter .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.btn--ghost:hover { color: var(--text); border-color: var(--accent); filter: none; }
.btn--sm { height: 38px; padding: 0 16px; font-size: 13px; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line-2);
  background: rgba(12,12,14,.6);
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }

/* ---------- Просмотр работы ---------- */

.viewer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.viewer[hidden] { display: none; }
.viewer__backdrop { position: absolute; inset: 0; background: rgba(6,6,8,.8); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

.viewer__window {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  width: min(1040px, 100%);
  max-height: 100%;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  overflow: hidden;
}
.viewer__close { position: absolute; top: 14px; right: 14px; z-index: 3; }

.viewer__photo { position: relative; background: #0f0f11; min-height: 320px; }
.viewer__photo img { width: 100%; height: 100%; object-fit: cover; }

.viewer__body { display: flex; flex-direction: column; gap: 12px; padding: 26px 28px 26px; overflow-y: auto; }
.viewer__type { margin: 0; font-size: 13px; font-weight: 600; color: var(--accent); }
.viewer__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1.2; }
.viewer__note { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-2); }

.viewer__rows { margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; }
.viewer__rows div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.viewer__rows div:last-child { border-bottom: 0; padding-bottom: 0; }
.viewer__rows dt { font-size: 13px; color: var(--text-4); }
.viewer__rows dd { margin: 0; font-size: 14px; font-weight: 600; text-align: right; }

.viewer__foot { display: flex; gap: 10px; margin-top: auto; padding-top: 12px; }

/* ---------- Адаптив ---------- */

@media (max-width: 1199px) {
  :root { --pad-x: 20px; }
  .nav, .header__phone { display: none; }
  .works { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero__in { padding: 28px var(--pad-x) 24px; }
  .viewer { padding: 0; }
  .viewer__window { width: 100%; height: 100%; max-height: 100%; border-radius: 0; border: 0; grid-template-columns: 1fr; grid-template-rows: 260px minmax(0, 1fr); }
  .viewer__photo { min-height: 0; }
}

@media (max-width: 639px) {
  .works { grid-template-columns: 1fr; }
  .work__photo { height: 180px; }
  .hero__title { font-size: 26px; }
  .cta { flex-direction: column; align-items: stretch; }
  .cta .btn { width: 100%; }
  .viewer__window { grid-template-rows: 200px minmax(0, 1fr); }
  .viewer__body { padding: 20px; }
  .viewer__foot { flex-direction: column; }
  .viewer__foot .btn { width: 100%; }
}

/* ---------- CRM-1871: живые данные из CRM ---------- */
.work__note { white-space: pre-line; }
.work__count {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(12,12,14,.72); color: var(--text);
  font-size: 12px; font-weight: 700; pointer-events: none;
}
.empty a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.viewer__photo img { object-fit: contain; }
.viewer__thumbs {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  display: flex; gap: 8px; overflow-x: auto; padding: 2px;
  scrollbar-width: none;
}
.viewer__thumbs::-webkit-scrollbar { display: none; }
.viewer__thumbs[hidden] { display: none; }
.viewer__thumbs button {
  flex: 0 0 auto; width: 58px; height: 58px; padding: 0;
  border: 2px solid rgba(255,255,255,.18); border-radius: 10px; overflow: hidden;
  background: #0f0f11; cursor: pointer; opacity: .78;
}
.viewer__thumbs button.is-on { border-color: var(--accent); opacity: 1; }
.viewer__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.viewer__note[hidden], .viewer__rows[hidden], .tags[hidden] { display: none; }
/* фото любой ориентации не растягивает окно просмотра */
.viewer__photo { overflow: hidden; }
.viewer__photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 1200px) {
  .viewer__window { height: min(640px, 100%); grid-template-rows: minmax(0, 1fr); }
}
.viewer__note { white-space: pre-line; }
@media (max-width: 1199px) {
  .viewer__window { grid-template-rows: minmax(240px, 52vh) minmax(0, 1fr); }
  .viewer__thumbs { left: 10px; right: 10px; bottom: 10px; gap: 6px; }
  .viewer__thumbs button { width: 46px; height: 46px; border-radius: 9px; }
}
