/* Витрина студии: главная bagnin.com и страницы кейсов /raboty/<кейс>/.
   Свой стиль без Tailwind: одна таблица на все страницы витрины, чтобы
   правка шапки или кнопки делалась в одном месте. Версия 2.1, 18.09.2026.

   Шрифт свой, с этого же домена: внешний шрифт в сети с VPN держал
   отрисовку, и страница на телефоне стояла пустой (прецедент 17.09.2026). */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('../fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20B8, U+2122, U+2191, U+2193, U+2212; }

:root {
  --bg: #fafaf9; --surface: #ffffff; --surface-2: #f5f5f4; --ink: #1c1917; --text: #44403c;
  --muted: #78716c; --line: #e7e5e4; --accent: #0f766e; --accent-hover: #115e59; --accent-text: #0f766e;
  --accent-line: rgba(15,118,110,.28); --chip: #ccfbf1; --chip-ink: #134e4a;
  --wa: #128c4a; --frame: #1c1917; --shadow: 0 24px 48px -30px rgba(28,25,23,.45);
  --radius: 18px; --max: 1160px;
}
html.dark {
  --bg: #0c0a09; --surface: #1c1917; --surface-2: #231f1d; --ink: #fafaf9; --text: #d6d3d1;
  --muted: #a8a29e; --line: rgba(255,255,255,.1); --accent: #0f766e; --accent-hover: #115e59; --accent-text: #5eead4;
  --accent-line: rgba(94,234,212,.3); --chip: rgba(94,234,212,.12); --chip-ink: #99f6e4;
  --wa: #25a35a; --frame: #000; --shadow: 0 24px 48px -30px rgba(0,0,0,.9);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-underline-offset: 3px; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.02em; margin: 0; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 10px; }
.skip:focus { top: 12px; }
.hidden { display: none !important; }
.nw { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px;
  border-radius: 14px; font: 600 16px/1.2 Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background .2s, transform .2s, border-color .2s; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent-line); }
.i-wa { color: var(--wa); }
.btn:active { transform: translateY(1px); }

/* Шапка */
.header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.header .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.nav { display: none; margin-left: auto; gap: 26px; }
.nav a { color: var(--text); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--accent-text); }
.head-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn { background: none; border: 0; color: var(--muted); width: 42px; height: 42px; border-radius: 12px; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
html.dark .i-moon, html:not(.dark) .i-sun { display: none; }
.head-cta { display: none; min-height: 42px; padding: 0 16px; border-radius: 12px; font-size: 15px; }
.menu { border-top: 1px solid var(--line); background: var(--bg); }
.menu nav { display: flex; flex-direction: column; padding: 8px 12px 14px; }
.menu a { color: var(--ink); text-decoration: none; padding: 12px; border-radius: 12px; font-size: 17px; }
.menu a:hover { background: var(--surface-2); }
@media (min-width: 900px) {
  .nav { display: flex; }
  .head-actions { margin-left: 18px; }
  .head-cta { display: inline-flex; }
  .burger, .menu { display: none !important; }
}

/* Первый экран */
.hero { padding: 40px 0 56px; }
.hero .wrap { display: grid; gap: 36px; align-items: center; }
@media (min-width: 960px) { .hero { padding: 64px 0 80px; } .hero .wrap { grid-template-columns: 1fr 1.08fr; gap: 48px; } }
.kicker { color: var(--muted); font-size: 15px; margin: 0 0 18px; }
.hero h1 { font-size: clamp(2.15rem, 6vw, 3.55rem); line-height: 1.06; font-weight: 800; margin: 0 0 18px; }
.hero h1 em { font-style: normal; color: var(--accent-text); }
.lead { font-size: clamp(1.05rem, 2.2vw, 1.2rem); margin: 0 0 26px; max-width: 34em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.cta-row .btn { flex: 1 1 220px; }
@media (min-width: 560px) { .cta-row .btn { flex: 0 0 auto; } }
.micro { color: var(--muted); font-size: 14px; margin: 14px 0 0; }

/* Снимки работы: рамка браузера и телефон поверх */
.stage { position: relative; display: block; padding: 0 16px 22px 0; color: inherit; text-decoration: none; }
.browser { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.browser-bar { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.browser-bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: block; }
.browser-bar span { margin-left: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browser img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.phone { position: absolute; right: 0; bottom: 0; width: 30%; max-width: 170px; border: 5px solid var(--frame); border-radius: 26px;
  overflow: hidden; background: var(--frame); box-shadow: 0 26px 44px -22px rgba(0,0,0,.55); }
.phone img { width: 100%; aspect-ratio: 1 / 2; object-fit: cover; object-position: top; border-radius: 20px; }

/* Разделы */
.section { padding: 64px 0; }
@media (min-width: 960px) { .section { padding: 88px 0; } }
.section-alt { background: var(--surface-2); }
.section-head { max-width: 40em; margin: 0 0 36px; }
.section-head h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.12; font-weight: 800; margin: 0 0 10px; }
.section-head p { margin: 0; color: var(--muted); }

/* Карточки кейсов на главной */
.cases { display: grid; gap: 28px; }
.case { display: grid; gap: 26px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 18px; }
@media (min-width: 960px) {
  .case { grid-template-columns: 1.15fr 1fr; gap: 44px; padding: 30px; }
  .case:nth-child(even) .stage { order: 2; }
}
.chip { display: inline-block; font-size: 13px; font-weight: 600; color: var(--chip-ink); background: var(--chip); border-radius: 999px; padding: 4px 11px; margin: 0 0 12px; }
.case h3 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); line-height: 1.2; margin: 0 0 10px; }
.case h3 a { color: inherit; text-decoration: none; }
.case h3 a:hover { color: var(--accent-text); }
.task { margin: 0 0 14px; }
.task b { color: var(--ink); }
.done { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 9px; }
.done li { position: relative; padding-left: 28px; }
.done li::before { content: ""; position: absolute; left: 0; top: .42em; width: 17px; height: 17px; border-radius: 50%;
  background: var(--chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 11px no-repeat; }
html.dark .done li::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235eead4' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E"); }
.case-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.case-foot .btn { min-height: 46px; }
.note { font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.more-works { margin: 28px 0 0; color: var(--muted); font-size: 15px; }

/* Услуги и цены */
.services { display: grid; gap: 18px; }
@media (min-width: 900px) { .services { grid-template-columns: repeat(3, 1fr); } }
.svc { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.svc.main { border: 2px solid var(--accent-line); }
.svc h3 { font-size: 1.2rem; margin: 0 0 8px; }
.svc p { margin: 0 0 18px; font-size: 15.5px; flex: 1; }
.price { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.price b { color: var(--ink); font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.price span { color: var(--muted); font-size: 14px; }
.svc .ex { font-size: 14px; margin-top: 10px; min-height: 1.6em; }
.svc-more { margin: 18px 0 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 24px; }
.svc-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.svc-all { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 18px 0 0; }
.svc-all span { color: var(--muted); max-width: 52ch; }
.svc-row:last-child { border-bottom: 0; }
.svc-row b { color: var(--ink); font-weight: 600; }
.svc-row .p { color: var(--ink); font-weight: 700; white-space: nowrap; text-align: right; }
.svc-row small { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
.fine { color: var(--muted); font-size: 14px; margin: 16px 0 0; }
.fine p { margin: 0 0 4px; }

/* Как работаю */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: s; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; counter-increment: s; }
.steps li::before { content: counter(s); display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: 10px; background: var(--chip); color: var(--chip-ink); font-weight: 800; margin-bottom: 12px; }
.steps b { display: block; color: var(--ink); margin-bottom: 4px; }
.steps span { font-size: 15px; }
details.terms { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.terms summary { cursor: pointer; padding: 18px 22px; font-weight: 600; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.terms summary::-webkit-details-marker { display: none; }
details.terms summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details.terms[open] summary::after { content: "–"; }
.terms-body { display: grid; gap: 8px 36px; padding: 0 22px 20px; }
@media (min-width: 900px) { .terms-body { grid-template-columns: 1fr 1fr; } }
.terms-body h3 { font-size: 1rem; margin: 6px 0 6px; }
.terms-body ul { margin: 0; padding-left: 1.1em; font-size: 15px; }
.terms-body li { margin: 5px 0; }

/* Обо мне */
.about { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .about { grid-template-columns: 340px 1fr; gap: 48px; } }
.about img { border-radius: 22px; border: 1px solid var(--line); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.about h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; margin: 0 0 14px; }
.about p { margin: 0 0 12px; }

/* Контакты */
.contact-box { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 28px 22px; }
@media (min-width: 900px) { .contact-box { padding: 44px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; } }
.contact-box h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; margin: 0 0 10px; }
.contact-box p { margin: 0 0 12px; }
.contact-actions { display: grid; gap: 12px; margin-top: 18px; }
@media (min-width: 900px) { .contact-actions { margin-top: 0; } }
.contact-actions .btn { width: 100%; min-height: 58px; font-size: 17px; }
.contact-links { font-size: 15px; color: var(--muted); margin: 6px 0 0; }

/* Страница кейса */
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.crumbs a { color: var(--muted); }
.case-hero { padding: 32px 0 48px; }
@media (min-width: 960px) { .case-hero { padding: 48px 0 72px; } }
.case-hero-grid { display: grid; gap: 34px; align-items: center; }
@media (min-width: 960px) { .case-hero-grid { grid-template-columns: 1fr 1.1fr; gap: 48px; } }
.case-hero h1 { font-size: clamp(1.95rem, 5vw, 3rem); line-height: 1.08; font-weight: 800; margin: 0 0 16px; }
.meta { color: var(--muted); font-size: 14px; margin-left: 8px; }
.case-body { display: grid; gap: 22px; }
@media (min-width: 960px) { .case-body { grid-template-columns: 1fr 1fr; gap: 26px; } }
.case-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.case-block h2 { font-size: 1.3rem; margin: 0 0 12px; }
.case-block p { margin: 0 0 10px; }
.case-block p:last-child, .case-block .done { margin-bottom: 0; }
.case-block.wide { grid-column: 1 / -1; }
.case-block.result { border: 2px solid var(--accent-line); }
.stack { font-size: 15px; color: var(--muted); }
.next-box { display: grid; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 28px 22px; }
@media (min-width: 900px) { .next-box { grid-template-columns: 1.2fr 1fr; padding: 40px; gap: 36px; } }
.next-box h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 800; margin: 0 0 8px; }
.next-box p { margin: 0 0 8px; }
.next-link { display: inline-block; margin-top: 22px; font-weight: 600; }

/* Подвал */
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 28px 0 120px; }
@media (min-width: 900px) { .footer { padding-bottom: 36px; } }
.footer p { margin: 4px 0; }
.footer a { color: inherit; }

/* Плавающий блок внизу: строка о cookie, помощник и запись. Один элемент fixed
   на всех ширинах — так кнопки не перекрывают друг друга. */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.dock > * { pointer-events: auto; }
.cookie { display: flex; align-items: center; gap: 10px; margin: 0 auto 10px; max-width: 560px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 10px 10px 14px; font-size: 13.5px; line-height: 1.4; box-shadow: var(--shadow); }
.cookie p { margin: 0; flex: 1; }
.cookie button { flex: none; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: 600 14px Inter, system-ui, sans-serif; cursor: pointer; }
@media (max-width: 560px) { .cookie { font-size: 12.5px; padding: 8px 8px 8px 12px; } .cookie button { padding: 7px 10px; } }
/* Кнопки записи появляются, когда кнопки первого экрана ушли вверх.
   Помощник виден сразу: спрятанный в контактах, его не нашел сам PO
   (18.09.2026, версия 2.1). Пустая часть полосы нажатия не ловит. */
.dock-row { display: flex; justify-content: flex-end; gap: 8px; pointer-events: none; }
.dock-row > * { pointer-events: auto; }
.dock-row .btn { min-height: 52px; box-shadow: 0 14px 30px -14px rgba(0,0,0,.5); }
.dock:not(.show) .dock-tg, .dock:not(.show) .dock-wa { display: none; }
.dock.show .dock-tg, .dock.show .dock-wa { animation: dock-in .3s ease both; }
@keyframes dock-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.dock-tg { flex: 1; }
.dock-wa, .dock-ai { width: 52px; padding: 0; flex: none; }
.dock-ai { color: var(--accent-text); }
.dock-tg .long, .dock-ai .lbl { display: none; }
@media (min-width: 900px) {
  .dock { left: auto; right: 20px; bottom: 20px; padding: 0; display: flex; flex-direction: column; align-items: flex-end; }
  .cookie { margin: 0 0 12px; max-width: 420px; }
  .dock-tg { flex: none; }
  .dock-tg .long, .dock-ai .lbl { display: inline; }
  .dock-ai { width: auto; padding: 0 18px; }
}

/* Помощник: окно и сообщения. Скрипт помощника ставит классы Tailwind
   (ml-auto, mr-auto, text-center, animate-spin) — здесь их смысл, без
   самой библиотеки. */
#dgd-chat-window { position: fixed; z-index: 50; right: 12px; left: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); height: min(540px, calc(100svh - 160px));
  flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); }
#dgd-chat-window:not(.hidden) { display: flex; }
@media (min-width: 900px) { #dgd-chat-window { left: auto; right: 20px; bottom: 84px; width: 380px; } }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head b { display: block; color: var(--ink); }
.chat-head small { color: var(--muted); font-size: 12.5px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msgs > div { max-width: 85%; padding: 11px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.55; }
.chat-msgs > .ml-auto { margin-left: auto; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msgs > .mr-auto { margin-right: auto; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msgs > .text-center { max-width: none; font-size: 12.5px; text-align: center; color: var(--muted); border: 1px solid var(--line); background: none; }
.chat-msgs > [id^="loading-"] { background: none; border: 0; padding: 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.chat-msgs strong { color: var(--accent-text); }
.chat-msgs > .mr-auto div { display: flex; gap: 8px; margin-top: 6px; }
.chat-msgs > .mr-auto div > span:first-child { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-text); margin-top: 8px; flex: none; }
.chat-msgs a { color: inherit; text-decoration: underline; }
.chat-msgs svg { width: 14px; height: 14px; }
.chat-foot { border-top: 1px solid var(--line); padding: 10px; }
.chat-rec { align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(239,68,68,.1); color: #dc2626; font-size: 12.5px; font-weight: 600; }
.chat-rec:not(.hidden) { display: flex; }
.chat-rec button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.chat-input { display: flex; gap: 8px; align-items: center; }
.chat-input input { flex: 1; min-width: 0; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 0 14px; font: 16px Inter, system-ui, sans-serif; }
.chat-input input:focus { outline: none; border-color: var(--accent-text); }
.chat-input button { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-input button svg { width: 18px; height: 18px; }
.chat-input .send { background: var(--accent); border-color: var(--accent); color: #fff; }
.text-red-500 { color: #ef4444 !important; }
.animate-pulse { animation: pulse 1.4s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Мягкое появление карточек — силами браузера, без скриптов. Где браузер
   не умеет привязывать анимацию к прокрутке, карточки просто видны. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rise { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 28%; }
    @keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
  }
}
