/* Персональный агент в Telegram · deck styles
   World: warm charcoal, mustard accent, museum-catalogue precision. */

:root {
  --bg: #2a2825;
  --bg-deep: #1f1d1b;
  --ink: #ece7dc;
  --ink-2: #b8b1a4;
  --ink-3: #7f786d;
  --line: rgba(236, 231, 220, 0.14);
  --grid: rgba(236, 231, 220, 0.045);
  --accent: #e6c531;
  --accent-ink: #1f1d1b;
  --display: "Oswald", "Arial Narrow", sans-serif;
  --text: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-slide: 720ms;
  --stage-pad: clamp(28px, 4.5vw, 72px);
  --stage-h: 100svh;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(15px, 1.25vw, 22px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Stage ---------- */
.deck { position: fixed; inset: 0; }
.slide {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(20px, 3vw, 56px);
  padding: var(--stage-pad);
  padding-left: calc(var(--stage-pad) + 14px);
  padding-bottom: calc(var(--stage-pad) + 40px);
  background:
    linear-gradient(90deg, var(--accent) 0, var(--accent) 3px, transparent 3px) no-repeat,
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 64px 64px,
    radial-gradient(120% 90% at 30% 20%, #302d29 0%, var(--bg) 55%, var(--bg-deep) 100%);
  visibility: hidden;
  pointer-events: none;
}
.slide.is-active { visibility: visible; pointer-events: auto; z-index: 2; }
.slide.is-leaving { visibility: visible; z-index: 1; }

/* Entrance: image wipes in from the right edge, text rises. */
.slide.is-active .slide__media { animation: media-in var(--t-slide) var(--ease-out) both; }
.slide.is-active .slide__media img { animation: img-settle calc(var(--t-slide) + 400ms) var(--ease-out) both; }
.slide.is-active .rise { animation: rise 640ms var(--ease-out) both; }
.slide.is-active .rise:nth-child(1) { animation-delay: 120ms; }
.slide.is-active .rise:nth-child(2) { animation-delay: 200ms; }
.slide.is-active .rise:nth-child(3) { animation-delay: 260ms; }
.slide.is-active .rise:nth-child(4) { animation-delay: 320ms; }
.slide.is-active .rise:nth-child(5) { animation-delay: 380ms; }
.slide.is-active .rise:nth-child(6) { animation-delay: 440ms; }
.slide.is-active .rise:nth-child(7) { animation-delay: 500ms; }
.slide.is-active .rise:nth-child(8) { animation-delay: 560ms; }
.slide.is-leaving .slide__media, .slide.is-leaving .slide__text { animation: leave 320ms ease-in both; }

@keyframes media-in {
  from { clip-path: inset(0 0 0 100%); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes img-settle {
  from { transform: scale(1.06); filter: blur(6px); }
  to   { transform: scale(1); filter: blur(0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes leave {
  to { opacity: 0; transform: translateY(-10px); }
}
.deck.is-back .slide.is-active .slide__media { animation-name: media-in-back; }
@keyframes media-in-back {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* ---------- Text column ---------- */
.slide__text {
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0;
}
.slide__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(30px, 3.6vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0 0 0.55em;
  text-wrap: balance;
  max-width: 14ch;
}
.slide__title em { font-style: normal; color: var(--accent); }
.slide__lead {
  font-size: clamp(17px, 1.45vw, 26px);
  line-height: 1.4;
  color: var(--ink);
  margin: 0 0 1em;
  max-width: 38ch;
  text-wrap: pretty;
}
.slide__list { list-style: none; margin: 0; padding: 0; max-width: 44ch; }
.slide__list li {
  position: relative;
  padding: 0.42em 0 0.42em 1.5em;
  color: var(--ink-2);
  border-top: 1px solid var(--line);
  text-wrap: pretty;
}
.slide__list li:last-child { border-bottom: 1px solid var(--line); }
.slide__list li::before {
  content: "";
  position: absolute; left: 0; top: 1.02em;
  width: 14px; height: 1px; background: var(--accent);
}
.slide__list b { color: var(--ink); font-weight: 600; }
.slide__list .mono, .slide__lead .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.86em; color: var(--ink); background: rgba(236,231,220,0.06); padding: 0.08em 0.4em; border-radius: 4px; }
.slide__foot {
  margin-top: 1.4em;
  font-size: 0.78em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.slide__foot b { color: var(--accent); font-weight: 600; }

/* Steps / formula variants */
.formula {
  font-family: var(--display); text-transform: uppercase; font-weight: 400;
  font-size: clamp(18px, 1.9vw, 34px); line-height: 1.15; color: var(--ink);
  margin: 0.2em 0 1em;
}
.formula i { font-style: normal; color: var(--accent); padding: 0 0.3em; }
.steps { counter-reset: s; list-style: none; margin: 0; padding: 0; max-width: 44ch; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2.2em 1fr; gap: 0.6em; padding: 0.5em 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(s); font-family: var(--display); color: var(--accent); font-size: 1.35em; line-height: 1; padding-top: 0.05em; }
.steps b { color: var(--ink); font-weight: 600; }

/* ---------- Media column ---------- */
.slide__media {
  position: relative; min-width: 0; align-self: center;
  aspect-ratio: 3 / 2;
  width: min(100%, calc((var(--stage-h) - 2 * var(--stage-pad) - 40px) * 1.5));
  justify-self: end;
  overflow: hidden;
  background: #232120;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.7), 0 10px 24px -14px rgba(0,0,0,0.5);
}
.slide__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.slide__media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(236,231,220,0.08);
}
.slide__media .cap {
  position: absolute; left: 14px; bottom: 12px;
  font-size: 0.68em; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2); background: rgba(31,29,27,0.7); padding: 4px 8px;
  backdrop-filter: blur(6px);
}

/* Triptych (slide 13) */
.slide--triptych { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.slide--triptych .slide__text { justify-content: flex-start; }
.slide--triptych .slide__title { max-width: none; }
.triptych { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 1.6vw, 28px); align-self: stretch; min-height: 0; }
.triptych figure { margin: 0; display: grid; grid-template-rows: 1fr auto; gap: 10px; min-height: 0; }
.triptych .slide__media { aspect-ratio: auto; height: 100%; }
.triptych figcaption { color: var(--ink-2); font-size: 0.92em; line-height: 1.4; text-wrap: pretty; }
.triptych figcaption b { display: block; font-family: var(--display); text-transform: uppercase; font-weight: 500; color: var(--accent); font-size: 1.15em; letter-spacing: 0.02em; margin-bottom: 2px; }

/* Cover + closing: image full-bleed, text over it */
.slide--cover, .slide--closing {
  grid-template-columns: 1fr; padding: 0;
}
.slide--cover .slide__media, .slide--closing .slide__media {
  position: absolute; inset: 0; aspect-ratio: auto; width: 100%; height: 100%; justify-self: stretch; box-shadow: none; background: var(--bg-deep);
}
.slide--cover .slide__media img { opacity: 1; object-position: center top; }
.slide--closing .slide__media img { opacity: 0.55; }
.slide--closing .slide__media::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(31,29,27,0.92) 0%, rgba(31,29,27,0.65) 45%, rgba(31,29,27,0.15) 100%);
}
.slide--cover .slide__media::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(31,29,27,0) 55%, rgba(31,29,27,0.85) 100%);
}
.slide--cover .slide__text, .slide--closing .slide__text {
  position: relative; z-index: 2; padding: var(--stage-pad); padding-left: calc(var(--stage-pad) + 14px);
  justify-content: flex-end;
}
.slide--cover .slide__title { display: none; }
.slide--cover .slide__lead { max-width: 34ch; font-size: clamp(20px, 1.9vw, 34px); font-family: var(--display); font-weight: 400; letter-spacing: 0.01em; }
.slide--cover .skyline { display: none; }
.slide--closing .slide__title { font-size: clamp(40px, 5.4vw, 96px); max-width: 14ch; }
.byline { display: flex; gap: 2.2em; flex-wrap: wrap; color: var(--ink-2); font-size: 0.9em; }
.byline b { display: block; color: var(--ink); font-weight: 600; }

/* Skyline strip at the bottom of every slide (the reference's yellow city bars) */
.skyline {
  position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
  display: flex; align-items: flex-end; gap: 2px; padding: 0 0 0 3px;
  opacity: 0.9; pointer-events: none;
}
.skyline i { display: block; flex: 1 1 0; background: var(--accent); height: var(--h, 30%); transform-origin: bottom; }
.slide.is-active .skyline i { animation: bar 700ms var(--ease-out) both; animation-delay: calc(var(--i) * 6ms + 200ms); }
@keyframes bar { from { transform: scaleY(0); } }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud__rail {
  position: absolute; left: 0; top: 0; bottom: 0; width: 17px;
  display: flex; align-items: center; justify-content: center;
}
.hud__mark {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-size: 10px; letter-spacing: 0.22em; color: var(--ink-3); text-transform: uppercase; white-space: nowrap;
}
.hud__progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: rgba(236,231,220,0.08); }
.hud__progress i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; background: var(--accent); transition: transform 500ms var(--ease-out); }
.hud__counter {
  position: absolute; right: var(--stage-pad); top: calc(var(--stage-pad) * 0.55);
  font-family: var(--display); font-size: 15px; letter-spacing: 0.06em; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.hud__counter .hud__of { color: var(--ink-3); margin-left: 0.3em; }

/* ---------- Notes & help ---------- */
.notes {
  position: fixed; right: 20px; bottom: 44px; z-index: 20;
  width: min(460px, 42vw); max-height: 44vh; overflow: auto;
  background: rgba(31,29,27,0.92); color: var(--ink-2);
  border: 1px solid var(--line); padding: 14px 18px 16px;
  backdrop-filter: blur(10px); font-size: 15px; line-height: 1.5;
  box-shadow: 0 24px 50px -20px rgba(0,0,0,0.8);
}
.notes__head { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-size: 13px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.notes p { margin: 0; }
.help { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 20; background: rgba(31,29,27,0.92); border: 1px solid var(--line); padding: 10px 16px; font-size: 14px; color: var(--ink-2); backdrop-filter: blur(10px); }
.help p { margin: 0; }
kbd { font-family: var(--text); font-size: 0.85em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 6px; color: var(--ink); }

body.is-print .hud, body.is-print .notes, body.is-print .help { display: none; }
body.is-print .slide.is-active *, body.is-print .slide.is-active .skyline i { animation-duration: 1ms !important; animation-delay: 0ms !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .slide.is-active .slide__media, .slide.is-active .slide__media img, .slide.is-active .rise, .slide.is-active .skyline i,
  .slide.is-leaving .slide__media, .slide.is-leaving .slide__text { animation: fade 240ms ease-out both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .hud__progress i { transition: none; }
}

/* ---------- Narrow screens (phone preview) ---------- */
@media (max-aspect-ratio: 1/1) {
  body { overflow: auto; }
  .deck { position: static; }
  .slide { position: relative; inset: auto; visibility: visible; pointer-events: auto; grid-template-columns: 1fr; min-height: 100svh; padding-bottom: calc(var(--stage-pad) + 40px); }
  .slide__media { order: -1; }
  .slide--cover, .slide--closing { min-height: 100svh; padding: var(--stage-pad); padding-left: calc(var(--stage-pad) + 14px); }
  .slide--cover .slide__media, .slide--closing .slide__media { position: relative; inset: auto; aspect-ratio: 3 / 2; height: auto; width: 100%; }
  .slide--cover .slide__media img, .slide--closing .slide__media img { opacity: 1; }
  .slide--cover .slide__media::before, .slide--closing .slide__media::before { display: none; }
  .slide--cover .slide__text, .slide--closing .slide__text { padding: 0; justify-content: flex-start; }
  .slide--cover .skyline { display: flex; }
  .slide--triptych .triptych { grid-template-columns: 1fr; }
  .hud, .notes, .help { display: none; }
  .slide .slide__media, .slide .slide__media img, .slide .rise, .slide .skyline i { animation: none !important; }
}

/* ---------- Print → PDF ---------- */
@page { size: 1600px 900px; margin: 0; }
@media print {
  :root { --stage-h: 900px; --stage-pad: 64px; }
  html, body { overflow: visible; background: var(--bg); height: auto; font-size: 20px; }
  .deck { position: static; }
  .slide {
    position: relative; inset: auto; visibility: visible !important; pointer-events: auto;
    width: 1600px; height: 900px; overflow: hidden;
    page-break-after: always; break-after: page; break-inside: avoid;
  }
  .slide:last-child { page-break-after: auto; break-after: auto; }
  .slide *, .slide::before, .slide::after { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; clip-path: none !important; filter: none !important; }
  .slide--cover .slide__media img { opacity: 1 !important; }
  .slide--closing .slide__media img { opacity: 0.55 !important; }
  .hud, .notes, .help { display: none !important; }
  body, .slide, .slide__media img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
