/* ========================================================================
 * Travelmart AI presentation — tech/dark theme
 * Inspired by Anthropic / Linear / Vercel design language
 * ======================================================================== */

:root {
  --bg-0: #0a0a0a;
  --bg-1: #111111;
  --bg-2: #161616;
  --bg-3: #1d1d1d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --fg-0: #f5f5f5;
  --fg-1: #cfcfcf;
  --fg-2: #909090;
  --fg-3: #5a5a5a;

  --accent: #d97757;          /* anthropic-orange */
  --accent-soft: #d9775722;
  --accent-glow: #d9775744;
  --emerald: #4ade80;
  --azure: #60a5fa;
  --violet: #a78bfa;
  --rose: #f472b6;

  --code-bg: #0d0d0d;
  --code-line: rgba(255, 255, 255, 0.06);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-sans: ui-sans-serif, "Inter", "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 8px 32px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { background: var(--bg-0); color-scheme: dark; }
body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--fg-0);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* — Background ambient grid — */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 800px at 20% -10%, #1a0e08 0%, transparent 60%),
    radial-gradient(1000px 600px at 110% 110%, #0c1a1d 0%, transparent 55%),
    repeating-linear-gradient(0deg, var(--line) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 80px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ============================ Top chrome ============================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: linear-gradient(to bottom, rgba(10,10,10,0.95), rgba(10,10,10,0.6));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
  font-size: 13px;
  color: var(--fg-2);
}
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-1);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.topbar .brand-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.topbar .crumb {
  color: var(--fg-3);
}
.topbar .spacer { flex: 1; }
.topbar .meta { font-variant-numeric: tabular-nums; color: var(--fg-2); }

.progress {
  position: fixed;
  top: 47px; left: 0; right: 0;
  height: 2px;
  z-index: 49;
  background: rgba(255,255,255,0.04);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--rose) 100%);
  width: 0%;
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ============================ Slide deck ============================ */
.deck {
  position: fixed;
  inset: 48px 0 0 0;
  z-index: 1;
}

.slide {
  position: absolute;
  inset: 0;
  display: block;
  padding: 36px 40px 64px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 280ms ease, transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-y: auto;
  scrollbar-gutter: stable;
  visibility: hidden;
}
.slide::-webkit-scrollbar { width: 6px; }
.slide::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.slide.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
}
/* inner-flex даёт центрирование когда влезает, и нормальный скролл сверху, когда нет.
   flex-shrink:0 на детях критичен — иначе flex сжимает grid'ы и spacer'ы. */
.slide-inner {
  width: min(1100px, 100%);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 0;
}
.slide-inner > * { flex-shrink: 0; }

/* ============================ Typography ============================ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 16px;
  align-self: flex-start;
}
.eyebrow.is-emerald { color: var(--emerald); border-color: rgba(74,222,128,0.18); background: rgba(74,222,128,0.08); }
.eyebrow.is-azure   { color: var(--azure);   border-color: rgba(96,165,250,0.18); background: rgba(96,165,250,0.08); }
.eyebrow.is-violet  { color: var(--violet);  border-color: rgba(167,139,250,0.18); background: rgba(167,139,250,0.08); }

h1.slide-h1 {
  font-size: clamp(32px, 4.6vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--fg-0);
}
h2.slide-h2 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--fg-0);
}
h3.slide-h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--fg-0);
}
.lead {
  font-size: clamp(15px, 1.3vw, 19px);
  color: var(--fg-1);
  line-height: 1.5;
  max-width: 72ch;
  margin: 0 0 16px;
}
.muted { color: var(--fg-2); }
.dim   { color: var(--fg-3); }
.kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--fg-1);
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-1);
}
.tag.is-prod    { color: var(--emerald); border-color: rgba(74,222,128,0.25); }
.tag.is-warning { color: #f59e0b;        border-color: rgba(245,158,11,0.25); }
.tag.is-info    { color: var(--azure);   border-color: rgba(96,165,250,0.25); }

/* ============================ Layout helpers ============================ */
.grid {
  display: grid;
  gap: 12px;
}
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row.tight { gap: 8px; }
.row.center { align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
/* .spacer-sm = top margin модификатор (не отдельный div). Не задаём height,
   иначе ломает любой блок с этим классом (grid, p, case…). */
.spacer-sm { margin-top: 8px; }
/* .spacer и .spacer-lg — отдельные пустые div'ы для вертикального отступа */
.spacer    { height: 16px; flex-shrink: 0; }
.spacer-lg { height: 28px; flex-shrink: 0; }
.center-text { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 24px 0; }

/* ============================ Card primitives ============================ */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.card h3 { margin-top: 0; }
.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}
.card.is-feature {
  background:
    linear-gradient(180deg, rgba(217,119,87,0.06), transparent 35%),
    var(--bg-1);
  border-color: rgba(217,119,87,0.25);
}
.card.is-future {
  background:
    radial-gradient(600px 300px at 0% 0%, rgba(167,139,250,0.10), transparent 60%),
    var(--bg-1);
}
.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 8px;
}
.card h3 + p, .card h3 + ul { margin-top: 6px; }
.card p { margin: 0; color: var(--fg-1); }
.card ul { margin: 8px 0 0; padding-left: 18px; color: var(--fg-1); }
.card ul li { margin: 4px 0; }
.card .stat-num {
  font-family: var(--font-mono);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg-0);
  display: block;
  line-height: 1.05;
}
.card .stat-label {
  font-size: 12px;
  color: var(--fg-2);
  margin-top: 4px;
}

/* ============================ Code blocks ============================ */
pre.code, code.inline {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}
pre.code {
  margin: 10px 0 0;
  padding: 12px 14px;
  background: var(--code-bg);
  border: 1px solid var(--code-line);
  border-radius: var(--radius-md);
  overflow-x: auto;
  color: #d4d4d4;
  font-size: 12.5px;
  line-height: 1.55;
}
code.inline {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--fg-1);
  font-size: 0.92em;
}
.code-comment { color: #6a6a6a; }
.code-key     { color: #9cdcfe; }
.code-str     { color: #ce9178; }
.code-fn      { color: #dcdcaa; }
.code-num     { color: #b5cea8; }
.code-acc     { color: var(--accent); }

/* ============================ Title slide ============================ */
.title-slide {
  align-items: center;
  text-align: center;
}
.title-slide .slide-inner {
  max-width: 920px;
}
.title-slide .super {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 28px;
}
.title-slide h1 {
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--fg-0);
}

/* word that glitch-cycles through Travelmart / Persona / Верные решения */
.title-word {
  display: inline-block;
  position: relative;
  background: linear-gradient(180deg, var(--fg-0) 0%, #b0b0b0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  transition: filter 220ms ease;
}
.title-word.glitching {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--fg-0);
  animation: tm-glitch-shake 460ms steps(10, end);
  text-shadow:
     0.04em 0    0 rgba(244, 114, 182, 0.85),
    -0.02em -0.04em 0 rgba(96, 165, 250, 0.85),
     0.02em  0.04em 0 rgba(74, 222, 128, 0.7);
}
.title-word.glitching::before,
.title-word.glitching::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  text-shadow: none;
  mix-blend-mode: screen;
}
.title-word.glitching::before {
  color: #f472b6;
  animation: tm-glitch-clip-1 460ms steps(6, end);
}
.title-word.glitching::after {
  color: #60a5fa;
  animation: tm-glitch-clip-2 460ms steps(6, end);
}
@keyframes tm-glitch-shake {
  0%   { transform: translate(0); }
  12%  { transform: translate(-3px, 1px); }
  24%  { transform: translate(3px, -2px); }
  36%  { transform: translate(-2px, -3px); }
  48%  { transform: translate(2px, 2px); }
  60%  { transform: translate(-3px, 0); }
  72%  { transform: translate(2px, -1px); }
  84%  { transform: translate(-1px, 2px); }
  100% { transform: translate(0); }
}
@keyframes tm-glitch-clip-1 {
  0%   { clip-path: inset(0 100% 0 0); }
  20%  { clip-path: inset(20% 0 60% 0); transform: translate(-4px, 1px); }
  40%  { clip-path: inset(60% 0 10% 0); transform: translate(3px, -1px); }
  60%  { clip-path: inset(10% 0 75% 0); transform: translate(-3px, 2px); }
  80%  { clip-path: inset(80% 0 5% 0); transform: translate(2px, 0); }
  100% { clip-path: inset(0 100% 0 0); }
}
@keyframes tm-glitch-clip-2 {
  0%   { clip-path: inset(100% 0 0 0); }
  25%  { clip-path: inset(30% 0 40% 0); transform: translate(3px, 0); }
  50%  { clip-path: inset(50% 0 25% 0); transform: translate(-2px, 1px); }
  75%  { clip-path: inset(15% 0 60% 0); transform: translate(2px, -2px); }
  100% { clip-path: inset(100% 0 0 0); }
}
.title-slide .sub {
  font-size: clamp(18px, 1.7vw, 24px);
  color: var(--fg-1);
  max-width: 56ch;
  margin: 0 auto 32px;
}
.title-slide .nav-hint {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  font-size: 13px;
  color: var(--fg-3);
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}

/* ============================ Stack diagram ============================ */
.stack-map {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 8px;
}
.stack-layer {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.stack-layer h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.stack-layer .pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-1);
  font-size: 12px;
  margin: 3px 4px 3px 0;
  font-family: var(--font-mono);
}
.stack-layer .pill.has-ai {
  border-color: rgba(217,119,87,0.4);
  color: var(--accent);
  background: rgba(217,119,87,0.05);
}

/* ============================ Persona slides ============================ */
.persona-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.persona-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  flex-shrink: 0;
}
.persona-head .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--fg-3);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.persona-head h2 { margin: 0; }

.case {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 18px;
  align-items: stretch;
}
.case .pain h3,
.case .solution h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.case .pain h3 { color: #f87171; }
.case .solution h3 { color: var(--emerald); }
.case .pain, .case .solution {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.case .pain ul, .case .solution ul {
  margin: 0;
  padding-left: 18px;
  color: var(--fg-1);
}
.case .pain ul li, .case .solution ul li { margin: 6px 0; }

.flow {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.flow-step {
  flex: 1 1 160px;
  min-width: 160px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  position: relative;
}
.flow-step .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.flow-step h4 {
  margin: 4px 0 6px;
  font-size: 14px;
  color: var(--fg-0);
}
.flow-step p {
  margin: 0;
  font-size: 13px;
  color: var(--fg-2);
}
.flow-step + .flow-step::before {
  content: "→";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-3);
  font-family: var(--font-mono);
}

/* ============================ Footer slide nav ============================ */
.slide-foot {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: linear-gradient(to top, rgba(10,10,10,0.95), rgba(10,10,10,0.6));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 40;
  font-size: 13px;
  color: var(--fg-2);
}
.slide-foot .pos {
  font-family: var(--font-mono);
  color: var(--fg-1);
  font-variant-numeric: tabular-nums;
}
.slide-foot .arrows { display: flex; gap: 8px; margin-left: auto; }
.slide-foot button.btn-icon {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-1);
  height: 32px;
  width: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease, border-color 150ms ease;
}
.slide-foot button.btn-icon:hover {
  background: var(--bg-2);
  border-color: var(--line-strong);
}
.slide-foot .ask-btn {
  background: var(--accent);
  color: #1a0c05;
  border: 0;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.slide-foot .ask-btn:hover { filter: brightness(1.05); }

/* ============================ TOC overlay ============================ */
.toc {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.toc.is-open { opacity: 1; pointer-events: auto; }
.toc-panel {
  width: min(900px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.toc h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-3);
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.toc-list li {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--fg-1);
  border: 1px solid transparent;
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.toc-list li:hover {
  background: var(--bg-2);
  border-color: var(--line);
}
.toc-list li.is-current {
  border-color: rgba(217,119,87,0.4);
  color: var(--accent);
}
.toc-list .num {
  font-family: var(--font-mono);
  color: var(--fg-3);
  width: 28px;
}
.toc-list .part-row {
  grid-column: 1/-1;
  padding: 14px 12px 6px;
  border: 0;
  background: transparent;
  cursor: default;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.toc-list .part-row:hover { background: transparent; }

/* ============================ Live chat panel ============================ */
.chat {
  position: fixed;
  right: 16px;
  bottom: 60px;
  width: min(420px, 92vw);
  max-height: min(640px, 80vh);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms ease, opacity 200ms ease;
}
.chat.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.chat-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.chat-head .pulse {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--emerald);
  box-shadow: 0 0 12px var(--emerald);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.chat-head .close {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-1);
  height: 24px;
  width: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  scroll-behavior: smooth;
}
.chat-msg {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  max-width: 85%;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #1a0c05;
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-1);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
}
.chat-msg.error {
  align-self: stretch;
  background: rgba(248,113,113,0.05);
  border: 1px solid rgba(248,113,113,0.3);
  color: #fca5a5;
  font-size: 13px;
}
.chat-msg.assistant.is-streaming::after {
  content: "▍";
  color: var(--accent);
  margin-left: 2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}
.chat-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
}
.chat-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-0);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  outline: none;
  transition: border-color 150ms ease;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send {
  background: var(--accent);
  color: #1a0c05;
  border: 0;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  height: 38px;
}
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-meta {
  padding: 6px 12px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  display: flex;
  gap: 12px;
}

.chat-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 12px 8px;
}
.chat-suggestions button {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-1);
  padding: 5px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 150ms ease;
}
.chat-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================ Mobile ============================ */
/* Slightly tighter on shorter screens */
@media (max-height: 760px) {
  .slide { padding: 24px 36px 56px; }
  .spacer { height: 12px; }
  .spacer-lg { height: 20px; }
  .card { padding: 14px 16px; }
  .grid { gap: 10px; }
}

@media (max-width: 720px) {
  .topbar { padding: 0 12px; font-size: 12px; }
  .topbar .crumb { display: none; }
  .slide { padding: 24px 16px 64px; }
  .slide-inner { min-height: auto; justify-content: flex-start; }
  h1.slide-h1 { font-size: clamp(28px, 8vw, 40px); }
  h2.slide-h2 { font-size: clamp(22px, 6vw, 30px); }
  .lead { font-size: 15px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .case { grid-template-columns: 1fr; }
  .stack-map { grid-template-columns: 1fr; }
  .toc-list { grid-template-columns: 1fr; }
  .chat {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 56px;
    max-height: 70vh;
  }
  .slide-foot .ask-btn span:not(.icon) { display: none; }
}

/* ============================ Misc ============================ */
.no-select { user-select: none; }
.fade-in { animation: fadein 280ms ease; }
@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================ Subtle motion ============================
 * Stagger entry для детей активного слайда — даёт ощущение «слайд собирается».
 * Карточки: легкий lift на hover.
 * AI-пиллы: медленный glow.
 * Brand-dot: уже пульсирует через .pulse.
 * Всё отключается через prefers-reduced-motion.
 * ===================================================================== */

.slide.is-active .slide-inner > * {
  animation: tm-rise 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.slide.is-active .slide-inner > *:nth-child(1) { animation-delay: 40ms; }
.slide.is-active .slide-inner > *:nth-child(2) { animation-delay: 100ms; }
.slide.is-active .slide-inner > *:nth-child(3) { animation-delay: 160ms; }
.slide.is-active .slide-inner > *:nth-child(4) { animation-delay: 220ms; }
.slide.is-active .slide-inner > *:nth-child(5) { animation-delay: 280ms; }
.slide.is-active .slide-inner > *:nth-child(6) { animation-delay: 320ms; }
.slide.is-active .slide-inner > *:nth-child(n+7) { animation-delay: 360ms; }
@keyframes tm-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Inside-grid stagger — карты в гриде вспыхивают по очереди */
.slide.is-active .grid > * { animation: tm-rise 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.slide.is-active .grid > *:nth-child(1) { animation-delay: 220ms; }
.slide.is-active .grid > *:nth-child(2) { animation-delay: 290ms; }
.slide.is-active .grid > *:nth-child(3) { animation-delay: 360ms; }
.slide.is-active .grid > *:nth-child(4) { animation-delay: 430ms; }
.slide.is-active .flow > * { animation: tm-rise 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.slide.is-active .flow > *:nth-child(1) { animation-delay: 240ms; }
.slide.is-active .flow > *:nth-child(2) { animation-delay: 320ms; }
.slide.is-active .flow > *:nth-child(3) { animation-delay: 400ms; }
.slide.is-active .flow > *:nth-child(4) { animation-delay: 480ms; }

/* Card lift on hover — лёгкий */
.card { will-change: transform; }
.card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

/* AI-pills slow glow — намёк на «здесь что-то живое» */
.pill.has-ai {
  position: relative;
  isolation: isolate;
}
.pill.has-ai::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: 0 0 8px rgba(217, 119, 87, 0.35);
  opacity: 0;
  animation: tm-pill-glow 3.6s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes tm-pill-glow {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}
.pill.has-ai:nth-of-type(2)::after { animation-delay: 0.6s; }
.pill.has-ai:nth-of-type(3)::after { animation-delay: 1.2s; }
.pill.has-ai:nth-of-type(4)::after { animation-delay: 1.8s; }

/* Title gradient shift — текст слегка переливается */
.title-slide h1 {
  background: linear-gradient(180deg, var(--fg-0) 0%, #b0b0b0 100%);
  background-size: 100% 220%;
  animation: tm-title-shift 9s ease-in-out infinite;
  -webkit-background-clip: text;
  background-clip: text;
}
@keyframes tm-title-shift {
  0%, 100% { background-position: 50% 0%; }
  50%      { background-position: 50% 100%; }
}

/* Persona-icon idle ring + tap-in (combined) */
.persona-icon { transition: transform 240ms ease, box-shadow 240ms ease; }
.slide.is-active .persona-icon {
  animation:
    tm-persona-tap 600ms cubic-bezier(0.2, 0.8, 0.2, 1) 200ms both,
    tm-persona-ring 3.6s ease-in-out 1400ms infinite;
}
@keyframes tm-persona-tap {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes tm-persona-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 87, 0); }
  50%      { box-shadow: 0 0 0 6px rgba(217, 119, 87, 0.06); }
}

/* Stat-num count-up + idle breath */
.slide.is-active .stat-num {
  animation:
    tm-num-in 520ms cubic-bezier(0.2, 0.8, 0.2, 1) 280ms both,
    tm-stat-breath 5.2s ease-in-out 1800ms infinite;
}
@keyframes tm-num-in {
  0%   { opacity: 0; transform: translateY(4px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tm-stat-breath {
  0%, 100% { text-shadow: 0 0 0 transparent; }
  50%      { text-shadow: 0 0 16px rgba(217, 119, 87, 0.18); }
}

/* === Ambient scan beam — тонкая персиковая полоса раз в 9с === */
.deck::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    90deg,
    transparent 0%,
    transparent 46%,
    rgba(217, 119, 87, 0.06) 50%,
    transparent 54%,
    transparent 100%
  );
  background-size: 220% 100%;
  background-position: -110% 0;
  animation: tm-scan 9s ease-in-out infinite;
  mix-blend-mode: screen;
}
@keyframes tm-scan {
  0%   { background-position: -110% 0; }
  100% { background-position: 220% 0; }
}

/* === Card top-edge shimmer — тонкая полоска иногда пробегает по верху === */
.card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 8%;
  width: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  border-radius: inherit;
  animation: tm-card-shimmer 7s ease-in-out infinite;
  pointer-events: none;
}
.card.is-feature::before { background: linear-gradient(90deg, transparent, var(--rose), transparent); }
.card.is-future::before  { background: linear-gradient(90deg, transparent, var(--violet), transparent); }
@keyframes tm-card-shimmer {
  0%, 100% { opacity: 0; transform: translateX(0); }
  35%      { opacity: 0.55; transform: translateX(60%); }
  70%      { opacity: 0; transform: translateX(160%); }
}
.card:nth-of-type(2)::before { animation-delay: 1.5s; }
.card:nth-of-type(3)::before { animation-delay: 3.0s; }
.card:nth-of-type(4)::before { animation-delay: 4.5s; }

/* === Flow arrow pulse — стрелка между шагами слегка дышит === */
.flow-step + .flow-step::before {
  animation: tm-arrow-pulse 2.6s ease-in-out infinite;
}
@keyframes tm-arrow-pulse {
  0%, 100% { opacity: 0.4; transform: translateY(-50%) translateX(0); }
  50%      { opacity: 1;   transform: translateY(-50%) translateX(2px); }
}

/* === Code caret — мигающий курсор в конце pre.code === */
pre.code::after {
  content: "▍";
  display: inline-block;
  margin-left: 4px;
  color: var(--accent);
  animation: tm-caret 1.05s steps(2, end) infinite;
  vertical-align: baseline;
  font-size: 0.95em;
}
@keyframes tm-caret { 50% { opacity: 0; } }

/* === Eyebrow chip dot — мини-индикатор «слайд активен» === */
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 2px;
  box-shadow: 0 0 8px currentColor;
  animation: tm-eyebrow-blink 2.4s ease-in-out infinite;
}
@keyframes tm-eyebrow-blink {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

/* === Topbar brand-dot уже пульсирует через .pulse — оставляем === */

/* Reduced motion — всё на минимум */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .slide.is-active .slide-inner > *,
  .slide.is-active .grid > *,
  .slide.is-active .flow > *,
  .slide.is-active .stat-num,
  .slide.is-active .persona-icon { opacity: 1; transform: none; }
}

/* ============================ Final cat slide ============================ */
.cat-final {
  display: grid;
  grid-template-columns: minmax(200px, 320px) 1fr;
  gap: 36px;
  align-items: center;
  padding: 8px 0;
}
.cat-art {
  font-family: var(--font-mono);
  font-size: clamp(20px, 2.4vw, 32px);
  line-height: 1.15;
  white-space: pre;
  color: var(--accent);
  text-shadow: 0 0 18px var(--accent-glow);
  letter-spacing: 0;
  margin: 0;
  user-select: none;
  animation: tm-cat-float 6s ease-in-out infinite;
  text-align: center;
}
@keyframes tm-cat-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.cat-quote {
  font-size: clamp(17px, 1.7vw, 22px);
  line-height: 1.45;
  color: var(--fg-0);
  margin: 0;
}
.cat-quote .quiet {
  color: var(--fg-2);
  font-size: 0.9em;
}
.cat-sign {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
@media (max-width: 720px) {
  .cat-final { grid-template-columns: 1fr; gap: 18px; text-align: center; }
  .cat-art { text-align: center; font-size: 12px; }
}

/* Subtle highlight for keywords inline */
.hi { color: var(--accent); }
.hi-emerald { color: var(--emerald); }
.hi-azure   { color: var(--azure); }
.hi-violet  { color: var(--violet); }
