/*!
 * свóдноGPT — интерактивная демонстрация. 2026-08-06.
 * Тёмная секция «Ночь», акцент мятный, янтарь только на CTA-чипе.
 * Живёт отдельным файлом: монолит assets/style.css не трогаем.
 */

/* окно живёт прямо в hero страницы: заголовок, лид и сразу демонстрация */
.gptd-hero { margin-top: 44px; position: relative; z-index: 1; }

/* отдельная тёмная секция с подводкой (главная) */
.gptd-section { padding: 96px 0; background: var(--night); color: var(--night-ink); position: relative; overflow: hidden; }
.gptd-section .container { position: relative; z-index: 1; }
.gptd-section .gptd-hero { margin-top: 40px; }
.gptd-head { max-width: 720px; }
.gptd-head h2 { color: var(--night-ink); margin-bottom: 16px; }
/* янтарный em как в hero /ai/: на главной подводка повторяет ту страницу один в один */
.gptd-head h2 em { font-style: normal; color: var(--accent-soft); }
.gptd-head p.lead { color: var(--night-ink-2); max-width: 640px; margin-left: 0; }
/* три плашки про режимы переехали сюда из бывшей секции .ai-section */
.gptd-section .pillars { margin-top: 52px; margin-bottom: 0; }
/* CTA блока: до конца главной других призывов нет */
.gptd-cta { margin-top: 44px; text-align: center; position: relative; }

/* ---------- окно помощника ---------- */

.gptd {
  max-width: 980px;
  background: var(--night-elev);
  border: 1px solid var(--night-line);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  overflow: hidden;
  position: relative;
}
.gptd::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(181, 212, 194, .5), transparent);
  opacity: 0; transition: opacity .3s linear;
}
.gptd.is-busy::before { opacity: 1; animation: gptd-scan 1.6s linear infinite; }
@keyframes gptd-scan { 0% { transform: translateX(-30%); } 100% { transform: translateX(30%); } }

.gptd__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--night-line);
  background: rgba(255, 255, 255, .02);
}
.gptd__mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: rgba(181, 212, 194, .12);
  border: 1px solid rgba(181, 212, 194, .28);
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--primary-soft);
}
.gptd__name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.gptd__badge {
  margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--night-ink-3); border: 1px solid var(--night-line); border-radius: var(--r-pill); padding: 4px 10px;
  white-space: nowrap;
}
.gptd__replay {
  margin-left: 4px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--night-ink-3); background: none; border: 0; cursor: pointer; padding: 4px 2px;
  transition: color .15s linear;
}
.gptd__replay:hover { color: var(--primary-soft); }

/* ---------- лента ---------- */

.gptd__feed {
  padding: 24px 20px 8px;
  height: 420px;
  overflow-y: auto;
  display: flex; flex-direction: column;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--night-line) transparent;
}
/* пока сообщений мало, лента прижата к низу, как в мессенджере */
.gptd__stream { margin-top: auto; }
.gptd__feed::-webkit-scrollbar { width: 6px; }
.gptd__feed::-webkit-scrollbar-thumb { background: var(--night-line); border-radius: 3px; }

.gptd-msg {
  opacity: 0; transform: translateY(10px);
  transition: opacity .38s cubic-bezier(.22, .7, .2, 1), transform .38s cubic-bezier(.22, .7, .2, 1);
  margin-bottom: 14px;
  display: flex;
}
.gptd-msg.is-in { opacity: 1; transform: none; }
.gptd-msg--user { justify-content: flex-end; }

.gptd-bubble {
  max-width: 84%;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--night-ink-2);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--night-line);
  border-top-left-radius: 4px;
}
.gptd-bubble b { color: var(--night-ink); font-weight: 600; }
.gptd-bubble a { color: var(--primary-soft); text-decoration: none; border-bottom: 1px solid rgba(181, 212, 194, .35); }
.gptd-bubble a:hover { border-bottom-color: var(--primary-soft); }
.gptd-msg--user .gptd-bubble {
  background: rgba(79, 138, 108, .18);
  border-color: rgba(181, 212, 194, .3);
  color: var(--night-ink);
  border-radius: 14px; border-top-right-radius: 4px;
}

/* печатает */
.gptd-bubble--typing { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; }
.gptd-typing__label { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--night-ink-3); }
.gptd-dots { display: inline-flex; gap: 4px; }
.gptd-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary-soft); opacity: .35; animation: gptd-dot 1.1s ease-in-out infinite; }
.gptd-dots i:nth-child(2) { animation-delay: .15s; }
.gptd-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes gptd-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---------- карточка-артефакт ---------- */

.gptd-card {
  width: 92%;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--night-line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.gptd-card__title {
  padding: 12px 16px;
  border-bottom: 1px solid var(--night-line);
  font-size: 13px; font-weight: 600; letter-spacing: -.005em; color: var(--night-ink);
}
.gptd-card__body { padding: 16px; }

.gptd-source {
  padding: 10px 16px;
  border-top: 1px solid var(--night-line);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.5; color: var(--night-ink-3);
}
.gptd-source span {
  text-transform: uppercase; letter-spacing: .14em; color: var(--primary-soft);
  opacity: .75; margin-right: 8px;
}

.gptd-note { margin: 12px 0 0; font-size: 13px; line-height: 1.5; color: var(--night-ink-3); }

/* мост прибыль -> деньги */
.gptd-bridge__row { display: grid; grid-template-columns: 150px 1fr 76px; align-items: center; gap: 12px; padding: 5px 0; }
.gptd-bridge__name { font-size: 13px; color: var(--night-ink-2); }
.gptd-bridge__bar { height: 8px; background: rgba(255, 255, 255, .05); border-radius: 4px; overflow: hidden; }
.gptd-bridge__bar i { display: block; height: 100%; width: var(--w); border-radius: 4px; transform-origin: left center; animation: gptd-grow .6s cubic-bezier(.22, .7, .2, 1) both; }
.gptd-bridge__bar i.is-pos { background: linear-gradient(90deg, var(--primary), var(--primary-soft)); }
.gptd-bridge__bar i.is-neg { background: linear-gradient(90deg, #8C3B34, #C4564A); }
@keyframes gptd-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.gptd-bridge__val { font-family: var(--mono); font-size: 13px; text-align: right; }
.is-pos { color: var(--primary-soft); }
.is-neg { color: #E08B80; }
.is-warn { color: var(--amber-2); }

.gptd-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--night-line);
  font-size: 13px; color: var(--night-ink-2);
}
.gptd-total b { font-family: var(--mono); font-size: 17px; font-weight: 600; }

/* таблица */
.gptd-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gptd-t { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 420px; }
.gptd-t th {
  text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--night-ink-3); font-weight: 500; padding: 0 10px 8px 0; white-space: nowrap;
}
.gptd-t td { padding: 8px 10px 8px 0; border-top: 1px solid var(--night-line); color: var(--night-ink-2); }
.gptd-t__num { text-align: right; font-family: var(--mono); }
.gptd-t th.gptd-t__num { text-align: right; }
.gptd-t tfoot td { border-top: 1px solid var(--night-line); color: var(--night-ink); font-weight: 600; }

/* возраст долга */
.gptd-aging__row { display: grid; grid-template-columns: 130px 1fr 72px; align-items: center; gap: 12px; padding: 5px 0; }
.gptd-aging__name { font-size: 13px; color: var(--night-ink-2); }
.gptd-aging__bar { height: 8px; background: rgba(255, 255, 255, .05); border-radius: 4px; overflow: hidden; }
.gptd-aging__bar i { display: block; height: 100%; width: var(--w); border-radius: 4px; animation: gptd-grow .6s cubic-bezier(.22, .7, .2, 1) both; }
.gptd-aging__bar i.is-pos { background: linear-gradient(90deg, var(--primary), var(--primary-soft)); }
.gptd-aging__bar i.is-warn { background: linear-gradient(90deg, #A5761F, var(--amber-2)); }
.gptd-aging__bar i.is-neg { background: linear-gradient(90deg, #8C3B34, #C4564A); }
.gptd-aging__val { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--night-ink-2); }

.gptd-top { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--night-line); }
.gptd-top__head { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--night-ink-3); margin-bottom: 10px; }
.gptd-top__row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: baseline; padding: 5px 0; font-size: 13px; color: var(--night-ink-2); }
.gptd-top__row b { font-family: var(--mono); font-weight: 500; color: var(--night-ink); }
.gptd-top__row i { font-family: var(--mono); font-style: normal; font-size: 12px; color: var(--amber-2); }

/* календарь */
.gptd-tl { position: relative; }
.gptd-tl__row { display: grid; grid-template-columns: 52px 14px 1fr; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--night-ink-2); }
.gptd-tl__date { font-family: var(--mono); font-size: 12px; color: var(--night-ink-3); }
.gptd-tl__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--night-ink-3); justify-self: center; position: relative; }
.gptd-tl__row + .gptd-tl__row .gptd-tl__dot::before { content: ""; position: absolute; left: 50%; top: -22px; height: 22px; width: 1px; background: rgba(236, 241, 248, .12); transform: translateX(-50%); }
.gptd-tl__row.is-ok .gptd-tl__dot { background: var(--primary-soft); }
.gptd-tl__row.is-warn .gptd-tl__dot { background: var(--amber-2); }
.gptd-tl__row.is-bad .gptd-tl__dot { background: #C4564A; box-shadow: 0 0 0 4px rgba(196, 86, 74, .16); }
.gptd-tl__row.is-bad .gptd-tl__text { color: #E08B80; }

/* режимы */
.gptd-modes__row { display: grid; grid-template-columns: 132px 1fr; gap: 14px; padding: 7px 0; font-size: 13.5px; color: var(--night-ink-2); border-top: 1px solid var(--night-line); }
.gptd-modes__row:first-child { border-top: 0; padding-top: 0; }
.gptd-modes__key { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-soft); padding-top: 3px; }

/* ---------- чипсы и ввод ---------- */

.gptd__chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px 20px 18px;
  transition: opacity .25s linear;
}
.gptd__chips.is-hidden { opacity: 0; pointer-events: none; }

.gptd-chip {
  font-family: inherit; font-size: 13.5px; line-height: 1.2; font-weight: 500;
  color: var(--night-ink-2);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--night-line);
  border-radius: var(--r-pill);
  padding: 9px 15px; cursor: pointer;
  transition: border-color .15s linear, color .15s linear, background .15s linear, transform .15s linear;
}
.gptd-chip:hover { border-color: rgba(181, 212, 194, .45); color: var(--night-ink); transform: translateY(-1px); }
.gptd-chip--cta { color: var(--accent-soft); border-color: rgba(232, 197, 138, .35); text-decoration: none; }
.gptd-chip--cta:hover { border-color: var(--accent-soft); color: var(--accent-soft); background: rgba(232, 197, 138, .08); }

.gptd__form {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 14px 20px;
  border-top: 1px solid var(--night-line);
  background: rgba(255, 255, 255, .015);
}
.gptd__input {
  flex: 1; background: none; border: 0; outline: none;
  font-family: inherit; font-size: 15px; color: var(--night-ink);
  padding: 6px 0;
}
.gptd__input::placeholder { color: var(--night-ink-3); }
.gptd__send {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  border: 1px solid rgba(181, 212, 194, .3);
  background: rgba(181, 212, 194, .12);
  color: var(--primary-soft);
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s linear, transform .15s linear;
}
.gptd__send:hover { background: rgba(181, 212, 194, .22); transform: translateY(-1px); }
.gptd__send svg { width: 16px; height: 16px; }

/* дисклеймер: мелкая моно-строка. Селектор с двумя классами обязателен -
   внутри hero страницы .page-header p (0,1,1) иначе перебивает размер и цвет */
.gptd-hero p.gptd-foot {
  max-width: 980px; margin: 16px 0 0;
  font-family: var(--mono); font-size: 11px; line-height: 1.6; color: var(--night-ink-3);
}
.gptd-foot a { color: var(--primary-soft); text-decoration: none; border-bottom: 1px solid rgba(181, 212, 194, .3); }
.gptd-foot__cta {
  font-family: var(--mono); font-size: 11px; letter-spacing: inherit;
  color: var(--accent-soft); background: none; border: 0; border-bottom: 1px solid rgba(232, 197, 138, .35);
  padding: 0; margin-left: 4px; cursor: pointer; transition: border-color .15s linear;
}
.gptd-foot__cta:hover { border-bottom-color: var(--accent-soft); }

/* ---------- адаптив ---------- */

@media (max-width: 860px) {
  .gptd-section { padding: 64px 0; }
  .gptd__feed { height: 400px; padding: 18px 14px 6px; }
  .gptd-bubble { max-width: 92%; font-size: 14.5px; }
  .gptd-card { width: 100%; }
  .gptd-bridge__row { grid-template-columns: 108px 1fr 64px; gap: 8px; }
  .gptd-bridge__name, .gptd-aging__name { font-size: 12px; }
  .gptd-aging__row { grid-template-columns: 96px 1fr 62px; gap: 8px; }
  .gptd__bar { padding: 12px 14px; gap: 10px; }
  .gptd__badge { display: none; }
  .gptd__replay { margin-left: auto; }
  .gptd__chips { padding: 4px 14px 14px; }
  .gptd-chip { font-size: 12.5px; padding: 8px 13px; }
  .gptd__form { padding: 12px 12px 12px 14px; }
  .gptd__input { font-size: 15px; }
}

@media (max-width: 560px) {
  .gptd-modes__row { grid-template-columns: 1fr; gap: 2px; }
  .gptd-top__row { grid-template-columns: 1fr auto; }
  .gptd-top__row i { grid-column: 2; }

  /* мост и возраст долга: имя со значением в строку, полоса под ними */
  .gptd-bridge__row, .gptd-aging__row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name val" "bar bar";
    row-gap: 5px; padding: 8px 0;
  }
  .gptd-bridge__name, .gptd-aging__name { grid-area: name; font-size: 13px; }
  .gptd-bridge__val, .gptd-aging__val { grid-area: val; }
  .gptd-bridge__bar, .gptd-aging__bar { grid-area: bar; height: 6px; }

  .gptd__input { font-size: 14px; }

  /* таблицы шире экрана: правый край растворяется, видно что есть продолжение */
  .gptd-scroll {
    -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 86%, transparent 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gptd-msg { transition: none; opacity: 1; transform: none; }
  .gptd-bridge__bar i, .gptd-aging__bar i { animation: none; }
  .gptd.is-busy::before { animation: none; }
  .gptd__feed { scroll-behavior: auto; }
}
