/* Kadrion Stream — базовые стили.
   Намеренно обычные: системные шрифты, спокойный синий акцент, без внешних зависимостей. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-sunk: #eef0f4;
  --ink: #16191f;
  --ink-soft: #5b6472;
  --ink-faint: #8b94a3;
  --line: #e2e6ec;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #eff4ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --wrap: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --bg-soft: #1a1e25;
    --bg-sunk: #22272f;
    --ink: #e8ebf0;
    --ink-soft: #a4adbb;
    --ink-faint: #78818f;
    --line: #2b313a;
    --accent: #5b8cff;
    --accent-ink: #0e1116;
    --accent-soft: #1c2432;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip; /* страховка от декоративных слоёв */
}

/* Плавные переходы между страницами (Chrome 126+, остальные просто игнорируют). */
@view-transition { navigation: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

img, video { max-width: 100%; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- шапка ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: box-shadow .25s ease, border-color .25s ease;
}
.site-header.scrolled {
  box-shadow: 0 1px 0 var(--line), 0 6px 20px rgba(10, 14, 22, .07);
}
@media (prefers-color-scheme: dark) {
  .site-header.scrolled { box-shadow: 0 1px 0 var(--line), 0 8px 24px rgba(0, 0, 0, .35); }
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand svg { flex: none; }
.brand span { color: var(--ink-faint); font-weight: 500; }

.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav a {
  color: var(--ink-soft);
  font-size: 14.5px;
  position: relative;
  padding: 4px 0;
  transition: color .18s ease;
}
.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s cubic-bezier(.22, .61, .36, 1);
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a:hover::after { transform: scaleX(1); }
.nav a.on { color: var(--ink); font-weight: 550; }
.nav a.on::after { transform: scaleX(1); }

.burger {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 720px) {
  .nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 20px 14px;
  }
  .nav.open { display: flex; animation: nav-drop .26s cubic-bezier(.22, .61, .36, 1); }
  @keyframes nav-drop {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
  }
  .nav a { padding: 11px 0; border-bottom: 1px solid var(--line); }
  .nav a:last-child { border-bottom: 0; }
  .burger { display: block; }
}

/* ---------- герой ---------- */

/* Только вертикальные отступы: горизонтальные приходят от .wrap,
   шорткенд padding их бы затёр и контент прилип бы к краям экрана. */
.hero {
  padding-top: 44px;
  padding-bottom: 8px;
}
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.2;
  letter-spacing: -.02em;
}
.hero p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 62ch;
  font-size: 17px;
}

/* ---------- плеер ---------- */

.player-card {
  margin: 28px 0 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.player-shell {
  position: relative;
  background: #0d1014;
  aspect-ratio: 16 / 9;
}
.player-shell video { width: 100%; height: 100%; object-fit: contain; background: #0d1014; }

.player-note {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  color: #c9d1dc;
  background: #0d1014;
  font-size: 14.5px;
}
.player-note.show { display: flex; }
.player-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: #8fa3bd;
  background: rgba(255, 255, 255, .06);
  padding: 3px 7px;
  border-radius: 5px;
}

.player-meta {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}
.player-meta h2 { margin: 0; font-size: 16px; font-weight: 600; }
.player-meta .sub { color: var(--ink-faint); font-size: 13.5px; margin-left: auto; }

/* ---------- секции ---------- */

.section { padding-top: 40px; padding-bottom: 40px; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}
.section-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -.01em;
}
.section-head .muted { color: var(--ink-faint); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .25s ease, transform .25s cubic-bezier(.22, .61, .36, 1);
  color: inherit;
}
.card:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 2px 4px rgba(16, 24, 40, .05), 0 12px 28px rgba(16, 24, 40, .10);
  transform: translateY(-3px);
}
@media (prefers-color-scheme: dark) {
  .card:hover { box-shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 14px 32px rgba(0, 0, 0, .4); }
}

.card .thumb {
  aspect-ratio: 16 / 9;
  background: var(--bg-sunk);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* Мягкая подсветка, наезжающая при наведении. */
.card .thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% 120%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
}
.card:hover .thumb::before { opacity: 1; }
.card .thumb svg {
  opacity: .5;
  position: relative;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1), opacity .3s ease, color .3s ease;
}
.card:hover .thumb svg { transform: scale(1.14); opacity: .95; color: var(--accent); }
.card .dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(10, 13, 18, .78);
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.card .body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.card .desc { margin: 0; color: var(--ink-soft); font-size: 13.5px; }
.card .foot {
  margin-top: auto;
  padding-top: 10px;
  color: var(--ink-faint);
  font-size: 12.5px;
  display: flex;
  gap: 10px;
}

.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 550;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ---------- список уроков ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 26px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.lessons {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.lessons h3 {
  margin: 0;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.lesson {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  color: inherit;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  text-align: left;
  font: inherit;
}
.lesson:last-child { border-bottom: 0; }
.lesson:hover { background: var(--bg-soft); }
.lesson:hover .t { transform: translateX(2px); }
.lesson.on { background: var(--accent-soft); }

/* Вертикальный маркер активного урока: выезжает слева. */
.lesson::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .28s cubic-bezier(.22, .61, .36, 1);
}
.lesson.on::before { transform: scaleY(1); }
.lesson { position: relative; transition: background .2s ease; }
.lesson .t { transition: transform .2s ease; }
.lesson .n {
  flex: none;
  width: 22px;
  color: var(--ink-faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.lesson .t { flex: 1; font-size: 14.5px; line-height: 1.4; }
.lesson .d { flex: none; color: var(--ink-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; padding-top: 2px; }

/* ---------- текстовые страницы ---------- */

.prose { max-width: 72ch; padding: 36px 0 10px; }
.prose h1 { font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -.02em; margin: 0 0 18px; }
.prose h2 { font-size: 19px; margin: 30px 0 10px; letter-spacing: -.01em; }
.prose p, .prose li { color: var(--ink-soft); }
.prose li { margin-bottom: 6px; }
.prose .lead { font-size: 17px; color: var(--ink); }
.prose dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 16px 0; }
.prose dt { color: var(--ink-faint); font-size: 14px; }
.prose dd { margin: 0; }
@media (max-width: 560px) {
  .prose dl { grid-template-columns: 1fr; gap: 2px 0; }
  .prose dd { margin-bottom: 10px; }
}

/* ---------- подвал ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 50px;
  padding: 26px 0 40px;
  background: var(--bg-soft);
}
.site-footer .wrap {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--ink-faint);
  font-size: 13.5px;
}
.site-footer nav { display: flex; gap: 18px; margin-left: auto; flex-wrap: wrap; }
.site-footer a { color: var(--ink-soft); }

/* ---------- появление при скролле ---------- */

.rv {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s ease, transform .55s cubic-bezier(.22, .61, .36, 1);
  transition-delay: calc(var(--i, 0) * 60ms);
  will-change: opacity, transform;
}
.rv.in {
  opacity: 1;
  transform: none;
}
/* После появления снимаем will-change, чтобы не держать слои зря. */
.rv.done { will-change: auto; }

/* ---------- фон героя ---------- */

.hero {
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  /* Без выноса по горизонтали: вылезающий декор давал горизонтальный скролл. */
  inset: -40px 0 0;
  z-index: -1;
  background:
    radial-gradient(60% 120% at 15% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(50% 100% at 90% 10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 65%);
  pointer-events: none;
}

.hero-stats {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.hero-stats div { display: flex; flex-direction: column; gap: 2px; }
.hero-stats b {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.hero-stats span { font-size: 13px; color: var(--ink-faint); }

/* ---------- плеер: загрузка и смена урока ---------- */

.player-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .05) 50%, transparent 80%);
  background-size: 200% 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.player-shell.loading::after {
  opacity: 1;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from { background-position: 120% 0; }
  to   { background-position: -120% 0; }
}

.player-shell video {
  transition: opacity .35s ease;
}
.player-shell.swapping video { opacity: 0; }

.player-note { animation: fade-in .3s ease; }
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

.player-meta h2 {
  transition: opacity .25s ease, transform .25s ease;
}
.player-meta.swapping h2 {
  opacity: 0;
  transform: translateY(4px);
}

/* ---------- доступность ---------- */

:where(a, button, .lesson):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- уважение к системной настройке ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .rv { opacity: 1; transform: none; }
}
