/*
 * FILEfy — SEO-страницы редакторов студии и разворачиваемое рабочее окно.
 * Страница: сайдбар сайта слева, h1, вводный текст, «окно» с превью, статья.
 * Режим редактора (html.fy-craft-open): окно занимает всё справа от сайдбара
 * (на телефоне — весь экран), снизу вплотную — полоса РСЯ фиксированной высоты.
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --fy-accent: #7359d9;
  --fy-accent-2: #8b74e6;
  --fy-ink: #0f172a;
  --fy-text: #334155;
  --fy-muted: #64748b;
  --fy-line: #e2e8f0;
  --fy-win: #1b1c1f;
  --fy-win-bar: #23252b;
  --fy-win-line: #34373f;
  --fy-bar-h: 34px;
  --fy-ad-h: 90px;
}

body.fy-craft {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--fy-text);
}
body.fy-craft .main-content {
  min-width: 0;
  padding: 28px 32px 56px;
}

/* ───────── Посадочная страница ───────── */
.fy-landing { max-width: 1180px; margin: 0 auto; }

.fy-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--fy-muted);
}
.fy-crumbs a { color: var(--fy-muted); text-decoration: none; }
.fy-crumbs a:hover { color: var(--fy-accent); text-decoration: underline; }
.fy-crumbs span[aria-hidden] { opacity: .6; }

.fy-hero { margin: 0 0 22px; }
.fy-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 2.6vw + .6rem, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fy-ink);
  font-weight: 800;
}
.fy-lead {
  max-width: 860px;
  margin: 0 0 14px;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--fy-text);
}
.fy-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fy-badges li {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--fy-line);
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.fy-badges li::before { content: "✓ "; color: var(--fy-accent); }

/* ───────── «Окно» редактора ───────── */
.fy-window {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0 0 10px;
  background: var(--fy-win);
  border: 1px solid #2c2f36;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(30, 20, 80, .45), 0 2px 6px rgba(15, 23, 42, .08);
}
.fy-window-bar {
  flex: 0 0 var(--fy-bar-h);
  height: var(--fy-bar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
  background: var(--fy-win-bar);
  border-bottom: 1px solid var(--fy-win-line);
  color: #cbd5e1;
  font: 600 13px/1 Inter, system-ui, sans-serif;
  user-select: none;
}
.fy-window-dots { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.fy-window-dots i { width: 10px; height: 10px; border-radius: 50%; background: #4b4f58; display: block; }
.fy-window-dots i:nth-child(1) { background: #f87171; }
.fy-window-dots i:nth-child(2) { background: #fbbf24; }
.fy-window-dots i:nth-child(3) { background: #34d399; }
.fy-window-title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fy-window-title b { color: #fff; font-weight: 700; }
.fy-window-title span { color: #94a3b8; font-weight: 500; }
.fy-window-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin: 0 !important;
  padding: 0 10px !important;
  border: 1px solid #3c4047 !important;
  border-radius: 7px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #e2e8f0 !important;
  font: 600 12px/1 Inter, system-ui, sans-serif !important;
  transform: none !important;
  cursor: pointer;
}
.fy-window-btn:hover { background: #2f3239 !important; }
.fy-window-btn:focus-visible { outline: 2px solid var(--fy-accent); outline-offset: 2px; }
.fy-window-btn--primary { background: var(--fy-accent) !important; border-color: var(--fy-accent) !important; color: #fff !important; }
.fy-window-btn--primary:hover { background: var(--fy-accent-2) !important; }
.fy-only-open { display: none !important; }
html.fy-craft-open .fy-only-open { display: inline-flex !important; }
html.fy-craft-open .fy-only-closed { display: none !important; }

.fy-window-body {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 64vh;
  min-height: 240px;
  background: var(--fy-win);
  overflow: hidden;
}

/* Постер до первого запуска */
.fy-window-poster {
  position: absolute !important;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--fy-win) !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: pointer;
  overflow: hidden;
  z-index: 3;
}
.fy-window-poster svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: transform .5s ease, filter .3s ease;
}
.fy-window-poster:hover svg { transform: scale(1.015); filter: brightness(.82); }
.fy-window-cta {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  border-radius: 16px;
  background: rgba(17, 18, 22, .78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .08);
  color: #e2e8f0;
  text-align: center;
  font-family: Inter, system-ui, sans-serif;
  max-width: calc(100% - 32px);
}
.fy-window-cta strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  background: var(--fy-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 10px 24px -8px rgba(115, 89, 217, .8);
  white-space: nowrap;
}
.fy-window-poster:hover .fy-window-cta strong,
.fy-window-poster:focus-visible .fy-window-cta strong { background: var(--fy-accent-2); }
.fy-window-poster:focus-visible { outline: 3px solid var(--fy-accent); outline-offset: -3px; }
.fy-window-cta small { font-size: 12.5px; color: #a3aab8; line-height: 1.4; }

/* Рабочая область с canvas */
.fy-craft-stage {
  position: absolute;
  inset: 0;
  background: var(--fy-stage-bg, #1b1c1f);
  visibility: hidden;
  z-index: 1;
}
html.fy-craft-booted .fy-craft-stage { visibility: visible; }
html.fy-craft-booted .fy-window-poster { display: none !important; }
.fy-craft-stage canvas,
.fy-craft-stage [id$="_loading"],
.fy-craft-stage #loading,
.fy-craft-stage #device-lost {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
}
.fy-craft-stage canvas { display: block; outline: none; }

/* После сворачивания: живое окно-превью, клик разворачивает обратно */
.fy-window-resume {
  position: absolute !important;
  inset: 0;
  z-index: 4;
  display: none;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(10, 10, 14, .35) !important;
  box-shadow: none !important;
  transform: none !important;
  cursor: pointer;
}
html.fy-craft-booted:not(.fy-craft-open) .fy-window-resume { display: block; }
html.fy-craft-booted:not(.fy-craft-open) .fy-craft-stage { pointer-events: none; }

/* Полоса РСЯ под редактором — только в развёрнутом режиме */
.fy-craft-ad { display: none; }

.fy-window-note { margin: 0 0 30px; font-size: 13px; color: var(--fy-muted); }
.fy-window-note a { color: var(--fy-accent); }

/* ───────── Развёрнутый режим ───────── */
html.fy-craft-open,
html.fy-craft-open body {
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  overscroll-behavior: none;
  padding: 0 !important;
}
html.fy-craft-open body.fy-craft .main-content {
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}
html.fy-craft-open .fy-landing > :not(.fy-window) { display: none !important; }
html.fy-craft-open .fy-craft-fab,
html.fy-craft-open #filefyMobileDock { display: none !important; }

html.fy-craft-open .fy-window {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--filefy-sb-width, 280px);
  z-index: 1050;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transition: left .22s ease;
}
html.fy-craft-open .fy-window-body {
  flex: 1 1 auto;
  aspect-ratio: auto;
  max-height: none;
  min-height: 0;
  height: auto;
}
html.fy-craft-open .fy-craft-ad {
  display: block;
  position: relative;
  flex: 0 0 var(--fy-ad-h);
  height: var(--fy-ad-h);
  min-height: var(--fy-ad-h);
  max-height: var(--fy-ad-h);
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
  background: #15161a;
  contain: strict;
}
/* РСЯ вставляет вложенные div со случайными id (например, id6676541792623918787) — без отступов */
.fy-craft-ad *,
.fy-craft-ad *::before,
.fy-craft-ad *::after {
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
.fy-craft-ad > div,
.fy-craft-ad > div > div {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}
.fy-craft-ad iframe {
  display: block !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border: 0 !important;
}

/* ───────── Статья ───────── */
.fy-article {
  background: #fff;
  border: 1px solid var(--fy-line);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
  padding: 40px 48px 36px;
  color: var(--fy-text);
  font-size: 1rem;
  line-height: 1.75;
}
.fy-article > section + section { margin-top: 34px; }
.fy-article h2 {
  margin: 0 0 14px;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--fy-ink);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.fy-article h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--fy-accent), #b7a6f5);
}
.fy-article h3 { margin: 22px 0 8px; font-size: 1.12rem; color: #1e293b; }
.fy-article p { margin: 0 0 14px; }
.fy-article ul,
.fy-article ol { margin: 0 0 16px; padding-left: 22px; }
.fy-article li { margin: 0 0 8px; }
.fy-article a { color: var(--fy-accent); }
.fy-article .fy-steps { counter-reset: fy-step; list-style: none; padding: 0; }
.fy-article .fy-steps li { position: relative; padding: 0 0 0 46px; margin: 0 0 14px; min-height: 32px; }
.fy-article .fy-steps li::before {
  counter-increment: fy-step;
  content: counter(fy-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #f1edff;
  color: var(--fy-accent);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fy-gloss { margin: 6px 0 18px; display: grid; grid-template-columns: minmax(150px, 30%) 1fr; gap: 8px 18px; }
.fy-gloss dt { font-weight: 650; color: var(--text-primary, #1f2430); }
.fy-gloss dd { margin: 0; color: var(--text-secondary, #4a5160); }
@media (max-width: 600px) { .fy-gloss { grid-template-columns: 1fr; gap: 2px; } .fy-gloss dd { margin-bottom: 10px; } }
.fy-table-wrap { overflow-x: auto; margin: 6px 0 18px; -webkit-overflow-scrolling: touch; }
.fy-article table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: .95rem; line-height: 1.5; }
.fy-article th,
.fy-article td { padding: 11px 14px; border-bottom: 1px solid var(--fy-line); text-align: left; vertical-align: top; }
.fy-article th { background: #f8fafc; color: var(--fy-ink); font-weight: 600; }
.fy-article tr:last-child td { border-bottom: 0; }
.fy-note {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f7f5ff;
  border: 1px solid #e4dcff;
  color: #3b3363;
}
.fy-faq details { border: 1px solid var(--fy-line); border-radius: 12px; margin: 0 0 10px; background: #fbfcfe; }
.fy-faq summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 44px 14px 16px;
  position: relative;
  font-weight: 600;
  color: var(--fy-ink);
}
.fy-faq summary::-webkit-details-marker { display: none; }
.fy-faq summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--fy-accent);
}
.fy-faq details[open] summary::after { content: "−"; }
.fy-faq details > div { padding: 0 16px 14px; }
.fy-faq details > div p:last-child { margin-bottom: 0; }

.fy-related { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.fy-related li { margin: 0; }
.fy-related a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--fy-line);
  background: #f8fafc;
  color: #334155;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.fy-related a:hover { border-color: var(--fy-accent); color: var(--fy-accent); }

.fy-legal {
  margin: 18px 0 0;
  padding: 16px 20px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--fy-line);
  font-size: 13px;
  line-height: 1.6;
  color: var(--fy-muted);
}
.fy-legal p { margin: 0 0 8px; }
.fy-legal p:last-child { margin: 0; }
.fy-link-btn {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  transform: none !important;
  color: var(--fy-accent) !important;
  font: inherit !important;
  text-decoration: underline;
  cursor: pointer;
}

/* ───────── Кнопка меню сайта на телефоне (вместо старой шапки) ───────── */
.fy-craft-fab { display: none; }
@media (max-width: 900px) {
  .fy-craft-fab {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: rgba(115, 89, 217, .92) !important;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .25) !important;
    transform: none !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer;
    touch-action: manipulation;
  }
  body.fy-craft .main-content { padding: 16px 14px 40px !important; }
  .fy-crumbs { padding-right: 52px; }
  html.fy-craft-open .fy-window { left: 0; z-index: 1150; }
  html.fy-craft-open body.fy-craft .sidebar { transform: translateX(-100%) !important; }
  .fy-article { padding: 26px 18px 22px; border-radius: 16px; }
  .fy-article h2 { font-size: 1.28rem; }
  .fy-window { border-radius: 14px; }
  .fy-window-body { aspect-ratio: 4 / 3; max-height: 56vh; min-height: 220px; }
}
@media (max-width: 600px) {
  :root { --fy-ad-h: 100px; }
  .fy-lead { font-size: 1rem; }
  .fy-window-bar { padding-left: 10px; gap: 8px; }
  .fy-window-dots { display: none; }
  .fy-window-body { aspect-ratio: 4 / 5; max-height: 60vh; }
  .fy-window-cta { padding: 14px 16px; }
  .fy-window-cta strong { font-size: 15px; padding: 11px 18px; }
  .fy-badges li { font-size: 12px; padding: 5px 10px; }
  .fy-hide-xs { display: none !important; }
}
@media (max-height: 560px) {
  :root { --fy-ad-h: 60px; }
}

/* ───────── Окно «О редакторе» (лицензия и атрибуция) ───────── */
body.fy-craft dialog.fy-craft-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  overflow: auto;
  border: 1px solid #3c4047;
  border-radius: 12px;
  padding: 22px 22px 16px;
  background: #1c1f26;
  color: #e8eaed;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
body.fy-craft dialog.fy-craft-dialog::backdrop { background: rgba(2, 6, 23, .72); }
body.fy-craft dialog.fy-craft-dialog h2 { margin: 0 0 8px; font-size: 1.15rem; color: #f8fafc; }
body.fy-craft dialog.fy-craft-dialog p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: #cbd5e1; }
body.fy-craft dialog.fy-craft-dialog a { color: #c4b5fd; }
body.fy-craft dialog.fy-craft-dialog .fy-craft-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
body.fy-craft button.fy-craft-btn {
  padding: 0 12px !important;
  min-height: 36px;
  background: transparent !important;
  color: #e2e8f0 !important;
  border: 1px solid #3c4047 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  font: 600 13px/1 Inter, system-ui, sans-serif !important;
  transform: none !important;
  cursor: pointer;
}
body.fy-craft button.fy-craft-btn:hover { background: #26292f !important; }

@media (prefers-reduced-motion: reduce) {
  .fy-window-poster svg,
  html.fy-craft-open .fy-window { transition: none !important; }
}
