/* Migla — сайт. Тёмная тема по мотивам trymonocle.app; шрифт, цвета и элементы управления — из приложения (UI/DS). */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope[wght].ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0d0d0f;
  --ink: #ededeb;
  --ink-2: #8d8d89;
  --ink-3: #5f5f5c;
  --line: rgb(255 255 255 / .08);
  --line-2: rgb(255 255 255 / .16);
  --accent: #b3b9f2;
  --wrap: 1180px;
  --font: "Manrope", -apple-system, "SF Pro Text", system-ui, sans-serif;
  /* Токены приложения (DS, тёмная тема) */
  --ds-panel-a: #232327;
  --ds-panel-b: #1a1a1d;
  --ds-raised: #303035;
  --ds-ink: #f4f4f6;
  --ds-muted: #8e8e96;
  --ds-faint: #3a3a40;
  --ds-lavender: #bdb6d2;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.wrap { width: min(var(--wrap), 100% - 48px); margin-inline: auto; }
.wrap-wide { width: min(1320px, 100% - 32px); margin-inline: auto; }

/* ---------- Логотип: частицы тумана без подложки ---------- */
.brand-logo circle, .dialog-logo circle { fill: #eef0ff; }
.brand-logo .r1, .dialog-logo .r1 { opacity: .8; }
.brand-logo .r2, .dialog-logo .r2 { opacity: .5; }
/* Значок в шапке: точки колец медленно гаснут и разгораются вразнобой — туман чуть дышит.
   Длительность и сдвиг каждой точке задаёт site.js. */
.top .brand-logo .r1, .top .brand-logo .r2 { animation: fog-twinkle 4s ease-in-out infinite; }
/* Точки не гаснут совсем, только становятся чуть плотнее или прозрачнее — знак должен читаться всегда. */
.top .brand-logo .r1 { --lo: .62; --hi: .95; }
.top .brand-logo .r2 { --lo: .36; --hi: .68; }
@keyframes fog-twinkle { 0%, 100% { opacity: var(--hi); } 50% { opacity: var(--lo); } }

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(24px, (100% - var(--wrap)) / 2);
  background: rgb(13 13 15 / .72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.top.is-scrolled { border-bottom-color: var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.top-nav { display: flex; align-items: center; }
.top-nav > * + * { margin-left: 24px; }

/* Ссылки текстом, без чипов. */
.text-link {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--ink-2); text-decoration: none; font-size: 15px;
  transition: color .2s;
}
.text-link:hover { color: var(--ink); }
[data-open-name].text-link { text-decoration: underline dotted rgb(255 255 255 / .35); text-underline-offset: 5px; text-decoration-thickness: 1px; }
[data-open-name].text-link:hover { text-decoration-color: var(--ink); }
.langs { display: inline-flex; gap: 10px; font-size: 14px; }
.langs a { color: var(--ink-3); text-decoration: none; letter-spacing: .04em; transition: color .2s; }
.langs a:hover { color: var(--ink); }
.langs a[aria-current="page"] { color: var(--ink); }
/* Кнопка в шапке появляется, когда кнопка первого экрана ушла из вида; скрытая — не занимает места. */
.top .top-download {
  max-width: 0; padding-inline: 0; margin-left: 0 !important; overflow: hidden; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .3s, max-width .35s, padding .35s, margin .35s;
}
.top.show-download .top-download { max-width: 160px; padding-inline: 16px; margin-left: 24px !important; opacity: 1; pointer-events: auto; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 28px; border-radius: 999px;
  text-decoration: none; font-weight: 600; font-size: 16px; border: 0; cursor: pointer;
  transition: transform .15s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: #111; }
.btn-primary:hover { background: #fff; }
.btn-small { height: 36px; padding: 0 16px; font-size: 14px; }

/* ---------- Первый экран ---------- */
.hero { padding: 104px 0 64px; }
h1 { margin: 0; font-size: clamp(40px, 6.4vw, 76px); line-height: 1.04; letter-spacing: -.035em; font-weight: 600; }
h1 span { color: var(--ink-3); }
.lead { max-width: 560px; margin: 26px 0 0; color: var(--ink-2); font-size: 19px; line-height: 1.55; }
.hero-actions { margin-top: 36px; display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; }
.dl-note { margin: 0; color: var(--ink-3); font-size: 14px; line-height: 1.45; }
.dl-note b { display: block; color: var(--ink-2); font-weight: 500; }

/* ---------- Демо ---------- */
.demo { padding: 32px 0 24px; scroll-margin-top: 70px; }

/* Панель настроек как в приложении: подложка панели, чипы с обводкой, точечные ползунки, крупные цифры. */
.panel {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px 36px;
  width: fit-content; max-width: 100%; margin: 0 auto 18px; padding: 16px 30px 16px 18px;
  background: linear-gradient(var(--ds-panel-a), var(--ds-panel-b));
  border-radius: 44px;
  box-shadow: 0 24px 70px rgb(0 0 0 / .45), inset 0 0 0 .5px rgb(255 255 255 / .06);
}
.chips { display: flex; gap: 6px; }
.chip {
  height: 34px; padding: 0 19px; border-radius: 999px; cursor: pointer;
  background: transparent; border: .8px solid var(--ds-faint); color: var(--ds-muted);
  font-size: 13px; font-weight: 400; transition: transform .15s, color .15s, border-color .15s;
}
.chip:hover { transform: scale(1.03); }
.chip:active { transform: scale(.95); }
.chip[aria-checked="true"] { border: 1.3px solid var(--ds-ink); color: var(--ds-ink); font-weight: 500; }

.dial { width: 220px; }
.dial-head { display: flex; align-items: baseline; gap: 7px; margin: 0 0 4px 12px; }
.dial-head b { font-size: 32px; line-height: 1; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--ds-ink); }
.dial-head span { font-size: 13px; font-weight: 300; color: var(--ds-muted); }

/* Точечный ползунок (DotSlider): линия, деления-точки, ручка. Настоящий input лежит сверху прозрачным. */
.dots { position: relative; height: 24px; --knob: 24px; }
.dots .line { position: absolute; left: calc(var(--knob) / 2); right: calc(var(--knob) / 2); top: 50%; height: .8px; background: var(--ds-faint); }
.dots .dot {
  position: absolute; top: 50%; width: 5px; height: 5px; border-radius: 50%;
  background: var(--ds-faint); transform: translate(-50%, -50%);
  transition: width .2s, height .2s, background .2s;
}
.dots .dot.passed { background: var(--ds-ink); }
.dots .dot.near { width: 12px; height: 12px; background: var(--ds-lavender); }
.dots.dragging .dot.near { width: 5px; height: 5px; background: var(--ds-ink); }
.dots .knob {
  position: absolute; top: 50%; width: var(--knob); height: var(--knob); border-radius: 50%;
  background: var(--ds-raised); box-shadow: inset 0 0 0 1px var(--ds-faint), 0 1px 3px rgb(0 0 0 / .4);
  transform: translate(-50%, -50%); transition: transform .15s, box-shadow .15s; pointer-events: none;
}
.dots.dragging .knob { transform: translate(-50%, -50%) scale(1.12); box-shadow: inset 0 0 0 1px var(--ds-faint), 0 2px 8px rgb(0 0 0 / .5); }
.dots input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.dots input::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; }
.dots input::-moz-range-thumb { width: 24px; height: 24px; border: 0; }
.dots:has(input:focus-visible) .knob { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.desk-frame {
  /* Весь стол вместе с панелью помещается в экран. */
  width: min(100%, calc((100svh - 230px) * 1.6)); margin-inline: auto;
  position: relative; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--line-2);
  box-shadow: 0 50px 120px rgb(0 0 0 / .6), 0 0 0 1px rgb(0 0 0 / .6);
  aspect-ratio: 16 / 10; background: #15172b;
}
#desk { display: block; width: 100%; height: 100%; touch-action: manipulation; }
.desk-hint { margin: 16px auto 0; max-width: 660px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* ---------- Эффект крышки: кадры ноутбука по прокрутке + экран в перспективе ---------- */
.lid-block { --lid-ar: calc(1926 / 1482); --lid-top: 65px; padding: 130px 0 0; }
.lid-head h2 { margin: 0; font-size: clamp(34px, 4vw, 54px); line-height: 1.06; letter-spacing: -.035em; font-weight: 600; }
.lid-head p { max-width: 600px; margin: 18px 0 0; color: var(--ink-2); font-size: 19px; line-height: 1.5; }
/* Высота прокрутки задаёт, сколько листать до полного открытия. Сцена прилипает под шапкой. */
.lid-scroll { position: relative; height: 290vh; }
.lid-sticky {
  position: sticky; top: var(--lid-top); height: calc(100vh - var(--lid-top)); height: calc(100svh - var(--lid-top));
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.lid-stage {
  position: relative; isolation: isolate; aspect-ratio: var(--lid-ar);
  width: min(calc(100% - 32px), 1560px, calc((100vh - var(--lid-top) - 40px) * var(--lid-ar)));
  width: min(calc(100% - 32px), 1560px, calc((100svh - var(--lid-top) - 40px) * var(--lid-ar)));
}
.lid-poster, .lid-frames { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* Картинка экрана: ставится в перспективе по углам экрана и складывается со стеклом как «экран». */
.lid-screen {
  position: absolute; left: 0; top: 0; width: 1280px; height: 852px;
  transform-origin: 0 0; mix-blend-mode: screen; pointer-events: none; opacity: 0;
}
.lid-hint {
  position: absolute; left: 0; right: 0; bottom: 18px; margin: 0; text-align: center;
  color: var(--ink-3); font-size: 14px; pointer-events: none;
}
@media (max-width: 900px) {
  .lid-block { padding-top: 90px; }
  .lid-scroll { height: 230vh; }
}

/* ---------- Настройки: фраза меняется под куски панели ---------- */
.tune { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 72px; padding: 140px 0 80px; }
.tune-say { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { margin: 0 0 18px; color: var(--ink-2); font-size: 15px; display: flex; gap: 12px; align-items: baseline; }
.tune-count { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 13px; }
.say { margin: 0; min-height: 300px; font-weight: inherit; }
.say .line { display: block; transition: opacity .35s, filter .35s, transform .35s; }
.say b { display: block; font-size: clamp(34px, 4vw, 54px); line-height: 1.06; letter-spacing: -.035em; font-weight: 600; color: var(--ink); }
.say span { display: block; max-width: 480px; margin-top: 20px; font-size: 20px; line-height: 1.5; font-weight: 400; color: var(--ink-2); }
.say.is-changing .line { opacity: 0; filter: blur(8px); transform: translateY(6px); }

.tune-list { display: flex; flex-direction: column; gap: 110px; padding: 30vh 0 34vh; }
.tune-list figure { margin: 0; transition: filter .5s, opacity .5s, transform .5s; filter: blur(7px); opacity: .35; transform: scale(.97); }
.tune-list figure.is-active { filter: none; opacity: 1; transform: none; }
.tune-list img { width: 100%; filter: drop-shadow(0 30px 60px rgb(0 0 0 / .5)); }
.tune-list figcaption { display: none; }

/* ---------- Вопросы ---------- */
.faq { max-width: 780px; padding: 60px 0 120px; scroll-margin-top: 70px; }
.faq h2 { margin: 0 0 30px; font-size: clamp(34px, 4vw, 52px); letter-spacing: -.03em; font-weight: 600; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 22px 0; font-size: 20px; letter-spacing: -.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ink-3); font-size: 26px; font-weight: 300; transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: -6px 0 24px; color: var(--ink-2); max-width: 640px; }
.name-more { margin-top: 36px; font-size: 17px; }

/* ---------- Подвал ---------- */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 30px 0 46px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
.foot .brand { font-weight: 500; color: var(--ink-2); }
.foot nav { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.foot nav > a, .foot nav > button { color: var(--ink-2); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: 14px; }
.foot nav > a:hover, .foot nav > button:hover { color: var(--ink); }

/* ---------- Окно «Что значит migla» ---------- */
.name-dialog {
  width: min(460px, 100% - 32px); padding: 36px 34px 30px; border: 1px solid var(--line-2); border-radius: 28px;
  background: #17171a; color: var(--ink); box-shadow: 0 40px 120px rgb(0 0 0 / .6);
}
.name-dialog::backdrop { background: rgb(8 8 10 / .45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.name-dialog[open] { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); filter: blur(6px); } }
.dialog-logo { display: block; margin-bottom: 22px; filter: drop-shadow(0 0 14px rgb(179 185 242 / .4)); }
.name-dialog h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.02em; font-weight: 600; }
.name-dialog .word { margin: 0 0 18px; color: var(--ink-2); }
.name-dialog .word b { color: var(--accent); font-weight: 600; }
.name-dialog p { margin: 0 0 12px; color: var(--ink-2); }
.name-dialog p:last-child { margin-bottom: 0; }
.name-dialog .close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer;
}
.name-dialog .close:hover { color: var(--ink); }

/* ---------- Окно установки ---------- */
.install-dialog {
  width: min(860px, 100% - 32px); max-height: calc(100dvh - 32px); padding: 40px 40px 30px; overflow: auto;
  border: 1px solid var(--line-2); border-radius: 28px; background: #17171a; color: var(--ink); box-shadow: 0 40px 120px rgb(0 0 0 / .6);
}
.install-dialog::backdrop { background: rgb(8 8 10 / .45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.install-dialog[open] { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
.install-dialog[open] .steps li { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.install-dialog[open] .steps li:nth-child(2) { animation-delay: .07s; }
.install-dialog[open] .steps li:nth-child(3) { animation-delay: .14s; }
.install-dialog h2 { margin: 0 0 6px; padding-right: 44px; font-size: clamp(24px, 6vw, 28px); letter-spacing: -.02em; font-weight: 600; }
.install-sub { margin: 0; color: var(--ink-2); }
.install-dialog .close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer;
}
.install-dialog .close:hover { color: var(--ink); }
.steps { list-style: none; counter-reset: step; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.steps li { counter-increment: step; }
.steps h3 { display: flex; gap: 10px; margin: 18px 0 6px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.steps h3::before { content: counter(step); flex: none; color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.steps p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.steps p b { color: var(--ink); font-weight: 500; }

/* Иллюстрации шагов — в стиле панели Migla */
.art {
  height: 132px; border-radius: 20px; border: 1px solid var(--line);
  background: linear-gradient(var(--ds-panel-a), var(--ds-panel-b));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 16px;
}
.art-drag { flex-direction: row; gap: 4px; }
.art-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.art-cap { font-size: 11px; color: var(--ds-muted); }
.app-ico { width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(#2c2c33, #1c1c20); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .1), 0 6px 18px rgb(0 0 0 / .35); }
.app-ico svg { width: 30px; height: 30px; }
.app-ico circle { fill: #eef0ff; } .app-ico .r1 { opacity: .8; } .app-ico .r2 { opacity: .5; }
.app-ico.sm { width: 26px; height: 26px; border-radius: 7px; } .app-ico.sm svg { width: 16px; height: 16px; }
.folder-ico svg { width: 58px; height: 52px; display: block; }
.folder-ico .f-back { fill: #3b4a7a; } .folder-ico .f-front { fill: #5b6fae; } .folder-ico .f-mark { fill: none; stroke: #c9d2f5; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.art-arrow { width: 56px; height: 12px; margin-bottom: 22px; fill: none; stroke: var(--ds-muted); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.art-arrow path:first-child { animation: march 1.2s linear infinite; }
@keyframes march { to { stroke-dashoffset: -16; } }
.mini-head { align-self: stretch; font-size: 11px; color: var(--ds-muted); padding-left: 4px; }
.mini-row {
  align-self: stretch; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px 8px 14px;
  border-radius: 12px; background: var(--ds-raised); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .06); font-size: 12px; color: var(--ds-ink);
}
.mini-text { flex: 1; min-width: 0; color: var(--ds-muted); line-height: 1.3; }
.mini-btn { flex: none; padding: 6px 11px; border-radius: 8px; background: #46464e; color: var(--ds-ink); font-weight: 500;
  box-shadow: 0 0 0 2px var(--accent); white-space: nowrap; }
.mini-name { flex: 1; }
.switch { flex: none; width: 34px; height: 20px; border-radius: 10px; background: var(--accent); position: relative; }
.switch::after { content: ""; position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .3); }
.install-foot { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.install-foot p { margin: 0; color: var(--ink-3); font-size: 14px; }
.install-ver { margin-left: 10px; font-variant-numeric: tabular-nums; }
.install-foot .text-link { font-size: 14px; }
.inline-link { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }

/* ---------- Узкие экраны ---------- */
@media (max-width: 900px) {
  .hide-narrow { display: none; }
  .install-dialog { padding: 32px 22px 24px; }
  .steps { grid-template-columns: 1fr; gap: 26px; }
  .art { height: 112px; }
  .install-ver { display: block; margin: 4px 0 0; }
  .hero { padding: 64px 0 40px; }
  .panel { border-radius: 34px; gap: 14px 22px; padding: 14px 18px; }
  .chips { width: 100%; justify-content: center; }
  .dial { width: calc(50% - 11px); min-width: 140px; }
  .desk-frame { width: 100%; }
  .tune { grid-template-columns: 1fr; gap: 0; padding-top: 80px; }
  .tune-say { position: static; height: auto; }
  .tune-say .say { display: none; }
  .tune-list { padding: 10px 0 40px; gap: 56px; }
  .tune-list figure { filter: none; opacity: 1; transform: none; }
  .tune-list img { max-width: 440px; margin-inline: auto; }
  .tune-list figcaption { display: block; max-width: 440px; margin: 18px auto 0; font-size: 18px; line-height: 1.45; color: var(--ink-2); }
  .tune-list figcaption b { color: var(--ink); font-weight: 600; }
}
@media (max-width: 560px) {
  .top-nav > * + * { margin-left: 16px; }
  .top.show-download .top-download { margin-left: 16px !important; }
  .top-nav > [data-open-name] { display: none; }
  .desk-frame { border-radius: 12px; }
  .chip { padding: 0 15px; }
  .dial-head b { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .top .brand-logo circle { animation: none; }
  .tune-list figure, .say .line { transition: none; }
}
