/* DoctorLev — стили. Светлая и тёмная темы задаются переменными. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #15212b;
  --heading: #0e2131;
  --muted: #586874;
  --line: #dbe4e9;
  --soft: #f2f6f7;
  --link: #1b6c68;
  --link-hover: #0e2131;
  --accent: #1b6c68;
  --accent-hover: #0e2131;
  --teal-bright: #4cc3bd;
  --teal-light: #8fe3dd; /* текст и рамка фокуса на тёмном фоне */
  --focus: #1b6c68;
  --navy: #0e2131;
  --navy-2: #163650;
  --header-bg: rgba(255, 255, 255, .94);
  --footer-bg: #0e2131;
  --shadow: 0 1px 2px rgba(14, 33, 49, .05), 0 6px 20px rgba(14, 33, 49, .06);
  --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%231b6c68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1520;
    --surface: #102030;
    --ink: #e2eaef;
    --heading: #f2f6f8;
    --muted: #a3b5c1;
    --line: #24394c;
    --soft: #13283a;
    --link: #6fd3cc;
    --link-hover: #ffffff;
    --accent: #1f7c76;
    --accent-hover: #2a958e;
    --focus: #6fd3cc;
    --header-bg: rgba(11, 21, 32, .92);
    --footer-bg: #07111a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%236fd3cc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
picture { display: block; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.hero, .cta, .site-footer, .viewer, .lightbox { --focus: var(--teal-light); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
.muted { color: var(--muted); }

.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 24px; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.page { padding-top: 28px; padding-bottom: 56px; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); color: var(--link); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* Шапка */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--heading); font-weight: 700; text-decoration: none; font-size: 18px; min-height: 44px; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 15px; font-weight: 500; white-space: nowrap; }
.site-nav a:hover { background: var(--soft); color: var(--heading); }
.site-nav a[aria-current="page"] { color: var(--link); background: var(--soft); }
.site-nav .nav-tg { color: var(--link); font-weight: 600; }
.nav-toggle { display: none; font: 600 15px var(--font); color: var(--heading); background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; min-height: 44px; cursor: pointer; }

/* Обложка */
.hero {
  position: relative; color: #fff;
  background-color: var(--navy);
  background-image: url("/assets/hero.jpg");
  background-image: image-set(url("/assets/hero.webp") type("image/webp"), url("/assets/hero.jpg") type("image/jpeg"));
  background-position: center; background-size: cover; background-repeat: no-repeat;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14, 33, 49, .62), rgba(14, 33, 49, .86)); }
.hero-inner { position: relative; padding-top: 76px; padding-bottom: 68px; max-width: 900px; }
.hero h1 { font-size: 48px; margin: 0 0 14px; }
.hero-small .hero-inner { padding-top: 40px; padding-bottom: 40px; }
.hero-small h1 { font-size: 36px; margin-bottom: 8px; }
.hero-lead { font-size: 19px; color: rgba(255, 255, 255, .9); margin: 0 0 12px; max-width: 760px; }
.hero-role { color: var(--teal-light); font-weight: 600; margin: 0 0 24px; font-size: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 13px; color: var(--teal-light); margin: 0 0 12px; font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }

/* Навигационная цепочка */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 12px; padding: 0; font-size: 14px; color: rgba(255, 255, 255, .88); }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: "›"; margin: 0 8px; color: rgba(255, 255, 255, .55); }
.crumbs a { color: rgba(255, 255, 255, .96); text-decoration: none; padding: 6px 0; }
.crumbs a:hover { color: #fff; text-decoration: underline; }
.crumbs [aria-current="page"] { color: rgba(255, 255, 255, .86); }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 600 15px/1.3 var(--font);
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--link); color: var(--link); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-light { background: #fff; border-color: #fff; color: var(--navy); }
.btn-light:hover { background: var(--teal-bright); border-color: var(--teal-bright); color: var(--navy); }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .55); color: #fff; }
.btn-ghost:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .1); }

/* Цифры */
.stats-band { background: var(--soft); border-bottom: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding-top: 22px; padding-bottom: 22px; }
.stats b { display: block; font-size: 24px; color: var(--heading); line-height: 1.2; }
.stats span { color: var(--muted); font-size: 14px; }

/* Блоки и карточки */
.block { margin: 44px 0; }
.block-first { margin-top: 8px; }
.block h2 { font-size: 28px; margin: 0 0 18px; color: var(--heading); }
.grid { display: grid; gap: 18px; }
.grid.three, .grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow); color: var(--ink);
}
.card h3 { margin: 0; font-size: 19px; color: var(--heading); }
.card p { margin: 0; color: var(--muted); }
.card.wide { max-width: 760px; }
.card.wide p + p { margin-top: 10px; }
.card-link { text-decoration: none; transition: transform .15s, border-color .15s; }
.card-link:hover { border-color: var(--link); transform: translateY(-2px); color: var(--ink); }
.card-more { margin-top: auto; padding: 10px 0 2px; color: var(--link); font-weight: 600; font-size: 15px; text-decoration: none; align-self: flex-start; }
a.card-more:hover { text-decoration: underline; }
.card-title { display: inline-block; padding: 2px 0; color: inherit; text-decoration: none; }
.card-title:hover { color: var(--link); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--heading); font-size: 13px; font-weight: 500; }
ul.mini { margin: 4px 0 0; padding-left: 18px; color: var(--ink); font-size: 15px; }
ul.mini li { margin: 2px 0; }
ul.mini a { color: var(--ink); text-decoration: none; display: inline-block; padding: 3px 0; }
ul.mini a:hover { color: var(--link); text-decoration: underline; }

ul.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
ul.ticks.two { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px 28px; }
ul.ticks li { position: relative; padding-left: 30px; }
ul.ticks li::before {
  content: ""; position: absolute; left: 0; top: .35em; width: 18px; height: 18px; border-radius: 50%;
  background: var(--soft) var(--tick) center / 14px no-repeat;
}

.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: var(--navy); color: #fff; border-radius: 18px; padding: 28px 30px;
}
.cta h2 { color: #fff; margin: 0 0 6px; font-size: 24px; }
.cta p { margin: 0; color: rgba(255, 255, 255, .82); max-width: 560px; }

.note {
  background: var(--soft); border-left: 4px solid var(--link); border-radius: 10px;
  padding: 16px 20px; font-size: 15px; color: var(--ink); margin-top: 36px;
}
.note p { margin: 0; }
.note p + p { margin-top: 8px; color: var(--muted); }

/* Вопросы и ответы */
.faq { display: grid; gap: 10px; max-width: 860px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; }
.faq summary { cursor: pointer; list-style: none; font-weight: 600; color: var(--heading); padding: 14px 28px 14px 0; position: relative; min-height: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 12px; font-size: 20px; color: var(--link); line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; color: var(--muted); }

/* Страница курса */
.lead { font-size: 18px; margin: 0 0 20px; max-width: 820px; }
.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 12px 24px; margin: 0; }
.meta div { border-top: 1px solid var(--line); padding-top: 8px; }
.meta dt { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.meta dd { margin: 2px 0 0; font-weight: 500; }

.viewer {
  position: relative; width: 100%; margin: 28px 0 10px; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  border: 1px solid var(--line);
}
.viewer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 16px; color: #fff; gap: 4px;
}
.viewer-title { font-size: 24px; font-weight: 700; margin: 0; }
.viewer-meta { margin: 0 0 10px; color: rgba(255, 255, 255, .78); }
.viewer-hint { margin: 8px 0 0; font-size: 13px; color: rgba(255, 255, 255, .68); max-width: 420px; }
.mobile-hint { display: none; margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; }

.outline summary {
  cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 10px; font-weight: 600; color: var(--link); background: var(--surface);
}
.outline[open] summary { margin-bottom: 14px; }
.outline ol { margin: 0; padding-left: 2.6em; columns: 2 340px; column-gap: 40px; font-size: 15px; }
.outline li { break-inside: avoid; margin: 0 0 4px; padding-left: 4px; }
.outline li::marker { color: var(--muted); font-size: 13px; }
.outline li.module { font-weight: 700; color: var(--heading); margin-top: 10px; }

.author {
  display: grid; grid-template-columns: 88px 1fr; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-top: 36px;
}
.author picture, .author img { width: 88px; height: 88px; }
.author img { border-radius: 50%; object-fit: cover; object-position: center 22%; }
.author p { margin: 0; }
.author-name { font-weight: 700; color: var(--heading); }
.author-role { color: var(--muted); font-size: 15px; margin-bottom: 4px !important; }
.author a { display: inline-block; padding: 4px 0; font-weight: 600; text-decoration: none; }

/* Обо мне */
.about-head { display: grid; grid-template-columns: 300px 1fr; gap: 32px; align-items: start; }
.portrait { width: 100%; border-radius: 18px; aspect-ratio: 1 / 1; object-fit: cover; object-position: center 20%; box-shadow: var(--shadow); }
.name { font-size: 28px; margin: 0 0 6px; color: var(--heading); }
.role { color: var(--link); font-weight: 600; margin: 0 0 14px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 160px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.when { color: var(--muted); font-weight: 600; font-size: 15px; }

.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 16px; margin-top: 14px; }
.doc {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.doc:hover { border-color: var(--link); transform: translateY(-2px); color: var(--ink); }
.doc img { width: 100%; height: auto; aspect-ratio: 520 / 368; object-fit: cover; border-radius: 8px; background: var(--soft); }
.doc-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.doc-meta { font-size: 13px; color: var(--muted); }

/* Просмотр документов */
.lightbox { border: 0; padding: 0; margin: auto; max-width: min(1200px, 96vw); width: 96vw; max-height: 96vh; background: transparent; color: #fff; overflow: visible; }
.lightbox::backdrop { background: rgba(4, 10, 16, .88); }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox img { max-width: 100%; max-height: 78vh; width: auto; height: auto; border-radius: 8px; background: #fff; }
.lightbox figcaption { text-align: center; font-size: 15px; color: rgba(255, 255, 255, .9); max-width: 760px; padding: 0 56px; }
.lightbox .lb-count { display: block; font-size: 13px; color: rgba(255, 255, 255, .6); margin-top: 2px; }
.lb-btn {
  position: fixed; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(14, 33, 49, .75); color: #fff; font: 600 24px/1 var(--font); cursor: pointer;
}
.lb-btn:hover { background: var(--accent); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-open { display: inline-block; margin-top: 4px; color: var(--teal-bright); font-size: 14px; }

.prose { max-width: 800px; }
.prose h2 { font-size: 24px; color: var(--heading); margin: 32px 0 10px; }
.prose h2:first-child { margin-top: 0; }

/* Подвал */
.site-footer { background: var(--footer-bg); color: rgba(255, 255, 255, .86); font-size: 15px; padding-bottom: env(safe-area-inset-bottom); }
.site-footer a { color: var(--teal-bright); }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; padding-top: 36px; padding-bottom: 24px; }
.footer-brand { color: #fff; font-weight: 700; margin: 0 0 8px; }
.footer-note { margin: 0; color: rgba(255, 255, 255, .72); max-width: 560px; }
.footer-title { color: #fff; font-weight: 600; margin: 0 0 4px; }
.footer-grid p { margin-top: 0; }
.footer-grid a { display: inline-block; padding: 3px 0; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 14px; padding-bottom: 22px; color: rgba(255, 255, 255, .58); font-size: 13px; }

/* Планшеты и телефоны */
@media (max-width: 920px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px max(24px, env(safe-area-inset-right)) 16px max(24px, env(safe-area-inset-left)); flex-direction: column; align-items: stretch; gap: 2px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 10px; font-size: 16px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .site-nav { padding: 8px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
  .hero {
    background-image: url("/assets/hero-1100.jpg");
    background-image: image-set(url("/assets/hero-1100.webp") type("image/webp"), url("/assets/hero-1100.jpg") type("image/jpeg"));
  }
  .hero-inner { padding-top: 48px; padding-bottom: 44px; }
  .hero h1 { font-size: 36px; }
  .hero-small .hero-inner { padding-top: 28px; padding-bottom: 28px; }
  .hero-small h1 { font-size: 28px; }
  .hero-lead { font-size: 17px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats b { font-size: 20px; }
  .block { margin: 32px 0; }
  .block h2 { font-size: 23px; }
  .about-head { grid-template-columns: 1fr; }
  .portrait { max-width: 260px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
  .viewer { aspect-ratio: 4 / 3; }
  .viewer-title { font-size: 20px; }
  .mobile-hint { display: block; }
  .cta { padding: 22px; }
  .cta .btn, .hero-actions .btn, .actions .btn { flex: 1 1 auto; }
  .outline ol { columns: 1; }
  .author { grid-template-columns: 64px 1fr; padding: 14px 16px; }
  .author picture, .author img { width: 64px; height: 64px; }
  .lightbox figcaption { padding: 0 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-link, .btn, .doc { transition: none; }
}

@media print {
  .site-header, .skip, .viewer, .mobile-hint, .actions, .hero-actions, .cta, .site-footer .footer-grid div:last-child { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .hero { background: none; color: #000; }
  .hero::before { display: none; }
  .hero h1, .hero-lead, .crumbs, .crumbs a { color: #000; }
  .card, .note, .author, .doc { box-shadow: none; border-color: #999; }
  .outline ol { columns: 2; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}
