/* ═══════════════════════════════════════════════════
   PresentationCG v2 — CORE
   Reset, CSS-переменные, типографика, layout слайдов
   ═══════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
img, video, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Шрифты (offline woff2 из _lib/fonts/) ── */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

/* ── CSS-переменные (тема по умолчанию — dark) ── */
:root {
  /* Палитра — переопределяется пресетом в style.css */
  --bg:      #0D0D0D;
  --bg-alt:  #1A1A2E;
  --text:    #FFFFFF;
  --text-dim: #94A3B8;
  --accent:  #0071E3;
  --accent2: #FF6B6B;
  --danger:  #EF4444;
  --success: #22C55E;

  /* Типографика */
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --font-body:  var(--font-sans);
  --font-heading: var(--font-sans);

  /* Размеры */
  --fs-xs:   clamp(0.7rem,  1vw,   0.8rem);
  --fs-sm:   clamp(0.8rem,  1.2vw,  0.95rem);
  --fs-base: clamp(0.95rem, 1.5vw,  1.15rem);
  --fs-lg:   clamp(1.3rem,  2.5vw,  2rem);
  --fs-xl:   clamp(2rem,    4vw,    3.5rem);
  --fs-hero: clamp(2.8rem,  6vw,    5.5rem);

  /* Геометрия */
  --radius:    16px;
  --radius-sm: 8px;
  --radius-xl: 28px;
  --radius-full: 999px;

  /* Тени */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.2);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.3);
  --shadow-lg:  0 20px 50px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(0,113,227,0.3);

  /* Анимации */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:   0.2s;
  --dur-base:   0.4s;
  --dur-slow:   0.8s;
  --dur-xslow:  1.2s;

  /* Размеры слайда */
  --slide-padding: clamp(24px, 5vw, 80px);
  --slide-max-w:   1200px;
  --slide-gap:     clamp(16px, 3vw, 40px);
}

/* ── Светлая тема ── */
[data-theme="light"] {
  --bg:      #FFFFFF;
  --bg-alt:  #F5F5F7;
  --text:    #1D1D1F;
  --text-dim: #6E6E73;
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.1);
  --shadow-lg:  0 20px 50px rgba(0,0,0,0.15);
}

/* ── prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Body ── */
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow: hidden; /* навигация через JS */
  -webkit-font-smoothing: antialiased;
}

/* ── Типографика ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-hero); font-weight: 700; }
h2 { font-size: var(--fs-xl);   font-weight: 700; }
h3 { font-size: var(--fs-lg);   font-weight: 600; }
p  { max-width: 65ch; }
code, pre {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}
pre {
  padding: 1.2em 1.5em;
  border-radius: var(--radius);
  background: rgba(0,0,0,0.4);
  overflow-x: auto;
  tab-size: 2;
}
blockquote {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-style: italic;
  border-left: 4px solid var(--accent);
  padding-left: 1.2em;
  max-width: 50ch;
}

/* ── Слайд-контейнер ── */
.slide {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--slide-padding);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  transition: none; /* переходы управляются transitions.css */
}
.slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}
.slide.is-prev,
.slide.is-next {
  z-index: 1;
}

.slide__inner {
  width: 100%;
  max-width: var(--slide-max-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--slide-gap);
}

/* ── Прогресс-бар ── */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 100;
  transition: width 0.3s var(--ease-out);
}

/* ── Номер слайда ── */
.slide-counter {
  position: fixed;
  bottom: 16px; right: 24px;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  z-index: 100;
  font-variant-numeric: tabular-nums;
}

/* ── Sidebar TOC ── */
.toc {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
}
.toc[hidden] { display: none; }
.toc__dot {
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  background: var(--text-dim);
  opacity: 0.4;
  transition: opacity var(--dur-fast), transform var(--dur-fast), background var(--dur-fast);
  font-size: 0;
  overflow: hidden;
}
.toc__dot:hover { opacity: 0.7; transform: scale(1.3); }
.toc__dot--active {
  background: var(--accent);
  opacity: 1;
  transform: scale(1.4);
}

/* ── Minimap ── */
.minimap {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(12px);
  z-index: 90;
  overflow-x: auto;
  align-items: center;
}
.minimap[hidden] { display: none; }
.minimap__thumb {
  flex-shrink: 0;
  width: 80px; height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--dur-fast);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs);
  color: var(--text-dim);
}
.minimap__thumb--active { border-color: var(--accent); }

/* ── Speaker Notes ── */
.speaker-notes {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 30vh;
  padding: 16px 24px;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  overflow-y: auto;
  z-index: 95;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.speaker-notes[hidden] { display: none; }

/* ── Timer ── */
.timer {
  position: fixed;
  top: 16px; right: 24px;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  z-index: 100;
  font-family: var(--font-mono);
}
.timer[hidden] { display: none; }

/* ── Keyboard Hints ── */
.kb-hints {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(16px);
  z-index: 200;
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.kb-hints[hidden] { display: none; }
.kb-hints kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  margin-right: 6px;
}

/* ── Overview (все слайды сеткой) ── */
body.is-overview { overflow: auto; }
body.is-overview .slide {
  position: relative;
  width: 280px; height: 180px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  flex-shrink: 0;
  font-size: 6px;
  cursor: pointer;
  transition: border-color var(--dur-fast);
}
body.is-overview .slide:hover { border-color: var(--accent); }
body.is-overview .slide.is-active { border-color: var(--accent); }
body.is-overview .progress-bar,
body.is-overview .toc,
body.is-overview .minimap,
body.is-overview .slide-counter { display: none; }

.overview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px;
  justify-content: center;
}

/* ── Утилиты ── */
.text-accent  { color: var(--accent); }
.text-accent2 { color: var(--accent2); }
.text-dim     { color: var(--text-dim); }
.text-left    { text-align: left; }
.text-right   { text-align: right; }
.mx-auto      { margin-inline: auto; }
.gap-sm       { gap: calc(var(--slide-gap) * 0.5); }
.gap-lg       { gap: calc(var(--slide-gap) * 1.5); }
.mt-auto      { margin-top: auto; }
.mb-0         { margin-bottom: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}