/* Pdfpero — дизайн-токены и базовые компоненты (handoff design_handoff_pdfpero).
   Палитра строго чёрно-бело-синяя: белый лист, чёрный текст, синяя паста. */

:root {
  --bg: #FFFFFF;
  --bg-soft: #FAFAFA;
  --bg-doc: #F2F2F2;
  --text: #111111;
  --muted: #6B6B6B;
  --muted2: #9A9A9A;
  --border: #E3E3E3;
  --border-dash: #C9C9C9;
  --accent: oklch(0.45 0.19 265);
  --accent-hover: oklch(0.42 0.19 265);
  --accent-light: oklch(0.96 0.02 265);
  --accent-faint: oklch(0.99 0.005 265);
  --ink: #1B2A6B;
  --cta-grad: linear-gradient(135deg, oklch(0.50 0.19 265), oklch(0.45 0.19 265));
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-page: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-cta: 0 4px 14px oklch(0.45 0.19 265 / 0.3);
}

@font-face {
  font-family: "Marck Script";
  src: url("/assets/MarckScript-Regular-f79c7fac.ttf") format("truetype");
  font-display: swap;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

.pp-col { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* Кнопки */
.pp-btn { display: flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box; border: none; cursor: pointer; font-family: inherit; text-decoration: none; transition: transform 0.08s ease; }
.pp-btn:active { transform: scale(0.97); }
.pp-btn-primary { width: 100%; min-height: 56px; border-radius: 16px; background: var(--cta-grad); color: #fff; font-size: 16px; font-weight: 700; box-shadow: var(--shadow-cta); }
.pp-btn-secondary { width: 100%; min-height: 52px; border-radius: 14px; background: #fff; border: 1.5px solid var(--accent); color: var(--accent); font-size: 15px; font-weight: 700; }
.pp-btn-outline { min-height: 44px; border-radius: 14px; background: #fff; border: 1.5px solid var(--border); color: var(--text); font-size: 14px; font-weight: 600; padding: 0 16px; }
.pp-btn-ghost { min-height: 44px; border-radius: 14px; background: none; color: var(--muted); font-size: 14px; font-weight: 600; padding: 0 14px; }
@media (hover: hover) {
  .pp-btn-ghost:hover { background: #F5F5F5; }
  .pp-btn-outline:hover { border-color: var(--accent); color: var(--accent); }
}

/* Dashed-зоны загрузки */
.pp-dropzone { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; box-sizing: border-box; background: #fff; border: 1.5px dashed var(--border-dash); border-radius: 20px; padding: 30px 24px; cursor: pointer; font-family: inherit; transition: border-color 0.15s, background 0.15s, transform 0.08s; }
.pp-dropzone:active { transform: scale(0.97); }
@media (hover: hover) { .pp-dropzone:hover, .pp-dropzone.pp-dragover { border-color: var(--accent); background: var(--accent-faint); } }
.pp-dropzone.pp-dragover { border-color: var(--accent); background: var(--accent-faint); }
.pp-dropzone.pp-disabled { opacity: 0.45; pointer-events: none; }

.pp-card { background: #fff; border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-card); }

/* Маркер-подложка в H1 */
.pp-marker { background: linear-gradient(transparent 62%, oklch(0.96 0.02 265) 62%); }

/* Пилюли */
.pp-pill { display: inline-block; border-radius: 99px; font-size: 13px; font-weight: 700; padding: 6px 12px; }
.pp-badge { background: var(--accent-light); color: var(--accent); transform: rotate(-2deg); }

/* Sticky CTA (мобилка) */
.pp-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: linear-gradient(transparent, rgba(255,255,255,0.92) 30%); padding: 18px 16px calc(12px + env(safe-area-inset-bottom)); }
.pp-sticky-inner { max-width: 640px; margin: 0 auto; }
@media (min-width: 1024px) { .pp-sticky { display: none; } }
.pp-desktop-only { display: none; }
@media (min-width: 1024px) { .pp-desktop-only { display: block; } .pp-mobile-only { display: none !important; } }

/* Подпись пользователя (превью) */
.pp-sig-line { border-bottom: 1px solid var(--border-dash); min-width: 200px; display: flex; align-items: flex-end; justify-content: center; }
.pp-handwriting { font-family: "Marck Script", cursive; color: var(--ink); }

/* Инпуты */
.pp-input { width: 100%; box-sizing: border-box; height: 52px; border-radius: 14px; border: 1.5px solid var(--border); background: #fff; padding: 0 16px; font-size: 16px; outline: none; font-family: inherit; color: var(--text); }
.pp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* Экран документа */
.pp-doc-bg { background: var(--bg-doc); min-height: 100vh; }
.pp-page { position: relative; background: #fff; border-radius: 4px; box-shadow: var(--shadow-page); }
.pp-page canvas { display: block; width: 100%; height: auto; border-radius: 4px; }

/* Найденное место подписи */
.pp-spot { position: absolute; background: oklch(0.96 0.02 265 / 0.7); border: 1.5px solid rgba(43,74,203,0.5); border-radius: 8px; animation: pp-pulse 1.8s ease-in-out infinite; pointer-events: none; }

/* Стикер подписи */
.pp-sticker { position: absolute; touch-action: none; cursor: move; user-select: none; -webkit-user-select: none; }
.pp-sticker img { width: 100%; height: 100%; display: block; pointer-events: none; }
.pp-sticker.pp-selected { outline: 1.5px solid var(--accent); outline-offset: 5px; }
.pp-handle { position: absolute; width: 14px; height: 14px; background: #fff; border: 1.5px solid var(--accent); border-radius: 99px; z-index: 2; }
.pp-handle-nw { left: -12px; top: -12px; cursor: nwse-resize; }
.pp-handle-ne { right: -12px; top: -12px; cursor: nesw-resize; }
.pp-handle-sw { left: -12px; bottom: -12px; cursor: nesw-resize; }
.pp-handle-se { right: -12px; bottom: -12px; cursor: nwse-resize; }
.pp-sticker-delete { position: absolute; right: -14px; top: -40px; width: 26px; height: 26px; border-radius: 99px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-card); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; color: var(--muted); z-index: 3; }

/* Тосты */
.pp-toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 90; background: #111; color: #fff; font-size: 13px; font-weight: 600; border-radius: 99px; padding: 10px 18px; animation: pp-toastin 0.25s ease; max-width: calc(100% - 32px); box-sizing: border-box; text-align: center; }

/* Оверлей обработки */
.pp-processing { position: fixed; inset: 0; z-index: 80; background: rgba(17,17,17,0.74); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; font-size: 17px; font-weight: 700; }

/* Bottom-sheet кабинета */
.pp-sheet-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,0.5); display: flex; align-items: flex-end; justify-content: center; }
.pp-sheet { width: 100%; max-width: 480px; background: var(--bg-soft); border-radius: 24px 24px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); animation: pp-sheet 0.3s ease; box-sizing: border-box; }
.pp-grabber { width: 36px; height: 4px; border-radius: 99px; background: var(--border-dash); margin: 4px auto 14px; }

/* Анимации */
@keyframes pp-draw { 0% { stroke-dashoffset: 190; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
.pp-draw path { stroke-dasharray: 190; stroke-dashoffset: 190; animation: pp-draw 1.6s ease-in-out infinite; }
@keyframes pp-pulse { 0%, 100% { box-shadow: 0 0 0 0 oklch(0.45 0.19 265 / 0.25); } 50% { box-shadow: 0 0 0 7px oklch(0.45 0.19 265 / 0); } }
@keyframes pp-fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pp-fadeup { animation: pp-fadeup 0.35s ease; }
@keyframes pp-sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pp-toastin { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* FAQ */
.pp-faq-item { border-bottom: 1px solid #EFEFEF; }
.pp-faq-q { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: none; border: none; text-align: left; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text); padding: 16px 0; cursor: pointer; }
.pp-faq-q .pp-plus { font-size: 18px; color: var(--muted2); transition: transform 0.2s; flex-shrink: 0; }
.pp-faq-item.open .pp-plus { transform: rotate(45deg); }
.pp-faq-a { display: none; font-size: 14px; color: var(--muted); line-height: 1.55; padding: 0 0 16px; margin: 0; }
.pp-faq-item.open .pp-faq-a { display: block; animation: pp-fadeup 0.3s ease; }

/* Лента превью результата */
.pp-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; scrollbar-width: none; }
.pp-strip::-webkit-scrollbar { display: none; }
.pp-strip-card { position: relative; flex: 0 0 150px; aspect-ratio: 1 / 1.414; border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden; scroll-snap-align: start; }
.pp-strip-card canvas { width: 100%; height: 100%; display: block; }

/* Десктоп: экран документа в 2 колонки */
.pp-doc-layout { max-width: 640px; margin: 0 auto; padding: 0 16px 150px; }
@media (min-width: 1024px) {
  .pp-doc-layout { max-width: 1024px; display: flex; gap: 24px; align-items: flex-start; padding-bottom: 60px; }
  .pp-doc-pages { flex: 1; }
  .pp-doc-side { width: 300px; position: sticky; top: 112px; flex-shrink: 0; }
}
.pp-doc-side { display: none; }
@media (min-width: 1024px) { .pp-doc-side { display: block; } }

[hidden] { display: none !important; }

/* CTA «Подписать документ»: серый, пока не загружены подпись и PDF */
.pp-btn-primary:disabled { background: #E3E3E3; color: #9A9A9A; box-shadow: none; cursor: default; }
.pp-btn-primary:disabled:active { transform: none; }
