/* "Пиши" — онбординг-страница (/about.html).
   Единый язык с самим сервисом: палитра «Dusk» (приглушённые затемнённые
   пастели), Inter для текста + Space Mono для «обвязки», геометрия пузырей
   мессенджера (радиус 18px, галочка в углу), тёплое янтарное свечение — только
   у лампочки. Тёмная тема — основная; светлая — аккуратный ремап тех же токенов.

   External, not inline: the prod CSP is `style-src 'self' https://fonts.googleapis.com`
   with no 'unsafe-inline', so an inline <style> is silently dropped — same reason
   moderator.css is its own file. Root-absolute href so it resolves at /about too. */

/* базовый :root = СВЕТЛАЯ палитра (светлая ОС / data-theme=light) */
:root {
  --panel:   #efeaec;
  --raised:  #ded7dc;
  --hair:    rgba(30, 22, 34, 0.10);
  --hair-2:  rgba(30, 22, 34, 0.17);

  --in:      #d6cbe2;
  --out:     #c2dad7;
  --ink-in:  #322b3a;
  --ink-out: #223330;
  --meta-in: rgba(50, 43, 58, 0.55);
  --meta-out:rgba(34, 51, 48, 0.55);

  --tick:    #4f71a6;
  --live:    #a2604a;
  --error:   #a3341a;
  --l-gold:  #866c2f;
  --l-sage:  #567a4f;

  --text:    #2a2431;
  --text-dim:#5f5768;
  --text-mut:#8a8194;

  --glow:    rgba(210, 150, 60, 0.45);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light dark;
}

/* тёмная тема — «Dusk», основной вид сервиса */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --panel:   #17141b;
    --raised:  #2b2530;
    --hair:    rgba(255, 255, 255, 0.09);
    --hair-2:  rgba(255, 255, 255, 0.14);

    --in:      #433b4e;
    --out:     #33474a;
    --ink-in:  #ece6ef;
    --ink-out: #e4efec;
    --meta-in: rgba(236, 230, 239, 0.5);
    --meta-out:rgba(228, 239, 236, 0.52);

    --tick:    #9db0d6;
    --live:    #cf9f83;
    --error:   #d98c6f;
    --l-gold:  #c7b17c;
    --l-sage:  #a2bf9c;

    --text:    #e7e2ea;
    --text-dim:#9a91a3;
    --text-mut:#6f6779;

    --glow:    rgba(255, 206, 120, 0.9);
  }
}
:root[data-theme="dark"] {
  --panel:   #17141b;
  --raised:  #2b2530;
  --hair:    rgba(255, 255, 255, 0.09);
  --hair-2:  rgba(255, 255, 255, 0.14);

  --in:      #433b4e;
  --out:     #33474a;
  --ink-in:  #ece6ef;
  --ink-out: #e4efec;
  --meta-in: rgba(236, 230, 239, 0.5);
  --meta-out:rgba(228, 239, 236, 0.52);

  --tick:    #9db0d6;
  --live:    #cf9f83;
  --error:   #d98c6f;
  --l-gold:  #c7b17c;
  --l-sage:  #a2bf9c;

  --text:    #e7e2ea;
  --text-dim:#9a91a3;
  --text-mut:#6f6779;

  --glow:    rgba(255, 206, 120, 0.9);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }

body {
  margin: 0;
  background: var(--panel);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* ———— эмбиент: медленно дрейфующие размытые пятна за текстом ———— */
.amb { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.amb i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
}
.amb .b1 {
  width: 46vmax; height: 46vmax; left: -14vmax; top: -12vmax;
  background: radial-gradient(circle, var(--in), transparent 70%);
  opacity: 0.5;
}
.amb .b2 {
  width: 40vmax; height: 40vmax; right: -12vmax; top: 24vmax;
  background: radial-gradient(circle, var(--out), transparent 70%);
  opacity: 0.45;
}
.amb .b3 {
  width: 34vmax; height: 34vmax; left: 12vmax; bottom: -14vmax;
  background: radial-gradient(circle, var(--glow), transparent 72%);
  opacity: 0.3;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px 88px;
}

/* ———— hero ———— */
.hero { padding-top: 76px; }
.kicker {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mut);
}
.hero h1 {
  margin: 14px 0 0;
  font-weight: 600;
  font-size: clamp(1.95rem, 6.2vw, 2.55rem);
  line-height: 1.16;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--text);
}
.hero .sub {
  margin: 15px 0 0;
  font-size: 1.02rem;
  color: var(--text-dim);
  max-width: 42ch;
  text-wrap: balance;
}

/* ———— секции механик ———— */
.sec { margin-top: 74px; }
.sec__eyebrow {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tick);
}
.sec h2 {
  margin: 10px 0 0;
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.3;
  text-wrap: balance;
  color: var(--text);
}
.sec p.body {
  margin: 12px 0 0;
  font-size: 0.97rem;
  color: var(--text-dim);
  max-width: 58ch;
}

.demo {
  margin-top: 20px;
  background: var(--raised);
  border: 1px solid var(--hair-2);
  border-radius: 16px;
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}
.demo--menu { min-height: 196px; }
/* room for the ⋮ control pinned near the bubble's top-right — was an inline
   style="padding-right: 26px" on each menu-demo bubble, which the prod CSP
   (style-src 'self', no 'unsafe-inline') silently drops. */
.demo--menu .bub { padding-right: 26px; }
.cap {
  margin: 13px 2px 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.55;
  color: var(--text-mut);
}

/* ———— пузыри ———— */
.feed { display: flex; flex-direction: column; }
.bub {
  position: relative;
  max-width: 84%;
  padding: 7px 11px 20px;
  border-radius: 18px;
  font-size: 0.94rem;
  line-height: 1.36;
  overflow-wrap: break-word;
}
.bub + .bub { margin-top: 8px; }
.bub--in  { align-self: flex-start; background: var(--in);  color: var(--ink-in); }
.bub--out { align-self: flex-end;   background: var(--out); color: var(--ink-out); }
/* extra clearance under a bubble that has the lightbulb chip hanging off its
   bottom edge — --chip when it's the last thing in the demo, --chip-tight when
   an inline chat panel follows immediately. Both were inline style="margin-
   bottom: …", which the prod CSP drops. */
.bub--chip { margin-bottom: 16px; }
.bub--chip-tight { margin-bottom: 2px; }
.time {
  position: absolute;
  right: 11px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--meta-in);
}
.bub--out .time { color: var(--meta-out); }
.otick { width: 15px; height: 10px; display: block; }
.otick path { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ———— чип-лампочка, свисающий с нижнего левого угла пузыря ———— */
.bub .chip {
  position: absolute;
  left: 8px;
  top: calc(100% - 10px);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--hair-2);
  line-height: 1;
}
.chip__glyph {
  font-size: 0.86rem;
  line-height: 1;
  filter: grayscale(1) brightness(0.7) opacity(0.55);
}
.chip--on .chip__glyph {
  filter: none;
  text-shadow: 0 0 6px var(--glow), 0 0 14px var(--glow);
}
.chip__n {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  color: var(--l-gold);
}

/* ———— строка ввода (демо «как писать») ———— */
.bar { display: flex; align-items: center; gap: 10px; }
.bar__bulb {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 206, 120, 0.4);
  background: radial-gradient(circle at 50% 45%, rgba(255, 199, 108, 0.16), var(--raised) 70%);
}
.bar__bulb span {
  font-size: 1.18rem;
  line-height: 1;
  text-shadow: 0 0 7px var(--glow), 0 0 16px var(--glow);
}
.bar__field {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--hair-2);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 0.92rem;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
}
.typed {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  border-right: 2px solid var(--tick);
}
.bar__send {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tick);
  color: var(--panel);
}
.bar__send svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ———— ⋮ меню ———— */
.menu { position: absolute; top: 5px; right: 7px; }
.menu__dots {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink-in);
  opacity: 0.65;
}
.bub--out .menu__dots { color: var(--ink-out); }
.menu__list {
  position: absolute;
  top: 21px;
  right: 0;
  min-width: 174px;
  display: flex;
  flex-direction: column;
  padding: 3px;
  border-radius: 9px;
  background: var(--raised);
  border: 1px solid var(--hair-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.menu__item {
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
}
.menu__item--hot { background: var(--hair); }
.menu__item[data-n]::after {
  content: attr(data-n);
  margin-left: auto;
  padding-left: 14px;
  font-size: 0.62rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.menu__note {
  margin-top: 2px;
  padding: 5px 8px 2px;
  border-top: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* ———— встроенный чат (демо «чужой чат») ———— */
.demo--chat .bub:not(.is-focus) {
  filter: grayscale(1) blur(1.5px);
  opacity: 0.5;
}
.chat {
  margin-top: 6px;
  border: 1px solid var(--hair-2);
  border-radius: 14px;
  background: var(--raised);
  overflow: hidden;
  transform-origin: top center;
  position: relative;
}
.chat__x {
  position: absolute;
  top: 6px; right: 9px;
  font-size: 0.78rem;
  line-height: 1;
  color: var(--text-mut);
}
.chat__intro {
  margin: 0;
  padding: 7px 30px 7px 10px;
  border-bottom: 1px solid var(--hair-2);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.35;
  color: var(--text-mut);
}
.chat__list {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cline {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.42;
  color: var(--text-dim);
}
.cline--mine { color: var(--text); }
.cline__t {
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 0.55rem;
  white-space: nowrap;
  color: var(--text-mut);
}
.chat__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-top: 1px solid var(--hair-2);
}
.chat__field {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--text-mut);
  background: var(--panel);
  border: 1px solid var(--hair-2);
  border-radius: 14px;
  padding: 5px 12px;
}
.chat__send {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tick);
  color: var(--panel);
}
.chat__send svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.copied {
  margin: 13px 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--l-sage);
}

/* ———— что стоит понимать ———— */
ul.notes {
  margin: 74px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--hair-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
ul.notes li {
  list-style: none;
  position: relative;
  padding-left: 16px;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.6;
  color: var(--text-dim);
}
ul.notes li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--text-mut);
}

/* ———— call to action ———— */
.hero__cta {
  margin: 22px 0 26px;
}
.sec__cta {
  margin-top: 18px;
}
.sec__cta a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--text);
  text-decoration: none;
  background: var(--raised);
  border: 1px solid var(--hair-2);
  border-radius: 999px;
  padding: 10px 22px;
  transition: border-color 0.15s, color 0.15s;
}
.sec__cta a:hover { border-color: var(--tick); }
.sec__cta a:focus-visible { outline: 2px solid var(--tick); outline-offset: 2px; }

.hero__cta a,
.cta a {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  background: var(--raised);
  border: 1px solid var(--hair-2);
  border-radius: 999px;
  padding: 13px 30px;
  transition: border-color 0.15s, color 0.15s;
}
.hero__cta a:hover,
.cta a:hover { border-color: var(--tick); }
.hero__cta a:focus-visible,
.cta a:focus-visible { outline: 2px solid var(--tick); outline-offset: 2px; }
.cta { margin-top: 40px; text-align: center; }
.cta .note {
  margin: 13px 0 0;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-mut);
}

/* ———— копирайт в углу у начала координат — как build-stamp в ленте ————
   Читается снизу вверх (180° поворот), стоит у верхнего края: конец строки
   (…© год) — у самого угла, длинную строку обрезает снизу. about.js — год. */
.stamp {
  position: fixed;
  left: 0; top: 0;
  z-index: 60;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transform-origin: center;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.6;
  letter-spacing: 0.05em;
  color: var(--text-mut);
  opacity: 0.7;
  padding: 6px 2px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

/* ————————————————————————————————————————————————
   Движение — только для тех, кто его не отключил.
   Всё, что можно прочитать, видно и в покое: анимация
   лишь оживляет уже показанный кадр и зациклена.
   ———————————————————————————————————————————————— */
@media (prefers-reduced-motion: no-preference) {
  .amb .b1 { animation: driftA 40s ease-in-out infinite alternate; }
  .amb .b2 { animation: driftB 52s ease-in-out infinite alternate; }
  .amb .b3 { animation: driftC 46s ease-in-out infinite alternate; }

  .is-fresh { animation: emerge 9s ease-out infinite; }

  .typed { width: 0; animation: type 9s steps(30, end) infinite, caret 1s step-end infinite; }
  .bar__send { animation: press 9s ease infinite; }

  .glow .chip__glyph { animation: glow 5.5s ease-in-out infinite alternate; }

  .drop { animation: drop 13s ease infinite; }
  .fade { opacity: 0; animation: fade 13s ease infinite; }

  .vanish { animation: vanish 11s ease infinite; }
}

@keyframes driftA { to { transform: translate(8vmax, 6vmax) scale(1.15); } }
@keyframes driftB { to { transform: translate(-7vmax, -5vmax) scale(1.1); } }
@keyframes driftC { to { transform: translate(4vmax, -8vmax) scale(1.2); } }

@keyframes emerge {
  0%  { opacity: 0; filter: blur(8px); transform: translateY(6px); }
  13% { opacity: 1; filter: blur(0);   transform: none; }
  86% { opacity: 1; filter: blur(0); }
  100%{ opacity: 0; filter: blur(8px); }
}

@keyframes type {
  0%   { width: 0; }
  44%  { width: 21ch; }
  62%  { width: 21ch; }
  100% { width: 0; }
}
@keyframes caret { 50% { border-color: transparent; } }
@keyframes press {
  0%, 54% { transform: none; }
  60%     { transform: scale(0.9); }
  68%     { transform: none; }
}

@keyframes glow {
  from { text-shadow: 0 0 4px var(--glow); }
  to   { text-shadow: 0 0 9px var(--glow), 0 0 20px var(--glow); }
}

@keyframes drop {
  0%   { opacity: 0; transform: translateY(-10px) scaleY(0.94); }
  6%   { opacity: 1; transform: none; }
  83%  { opacity: 1; transform: none; }
  91%  { opacity: 0; transform: translateY(-6px) scaleY(0.92); }
  100% { opacity: 0; }
}
@keyframes fade {
  0%, 14% { opacity: 0; }
  22%, 80% { opacity: 1; }
  90%, 100% { opacity: 0; }
}

@keyframes vanish {
  0%, 50% { opacity: 1; transform: none; }
  66%     { opacity: 0; transform: translateX(10px) scale(0.92); }
  84%     { opacity: 0; }
  100%    { opacity: 1; transform: none; }
}
