/* Шрифты локально (вариативные woff2, кириллица + латиница) —
   без запросов к fonts.googleapis.com, чтобы IP посетителей не уходил на сторонние серверы */
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/golos-text-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/static/fonts/golos-text-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Piazzolla";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/static/fonts/piazzolla-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Piazzolla";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/static/fonts/piazzolla-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Токены из макета Figma (ЗдравСайт.Аудит) */
:root {
  --ink: #10201c;
  --muted: #4a6560;
  --green: #0e6e5c;
  --green-dark: #0a584a;
  --red: #c4442a;
  --bg-soft: #f6f8f7;
  --bg-green: #eefaf7;
  --red-bg: #fef2f2;
  --border: #dce4e1;
  --font-body: "Golos Text", system-ui, sans-serif;
  --font-serif: "Piazzolla", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: #fff;
}

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

.container { max-width: 1056px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 712px; }
.center { text-align: center; }

.mono { font-family: var(--font-mono); }
.green { color: var(--green); }
.red { color: var(--red); }
.muted { color: var(--muted); }
.ok { color: var(--green); }
.fail { color: var(--red); }
.review { color: #a16207; }
.skip { color: var(--muted); }

h1, h2 { font-family: var(--font-serif); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.15; }
h2 { font-size: clamp(26px, 3.5vw, 32px); margin-bottom: 16px; }
h3 { font-size: 19px; font-weight: 600; margin-bottom: 8px; }

/* Кнопки */
.btn {
  display: inline-block;
  font: 500 15px/1 var(--font-body);
  padding: 14px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, transform .15s, box-shadow .2s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 110, 92, .25);
}
.btn-outline { border-color: var(--green); color: var(--green); background: transparent; }
.btn-outline:hover { background: var(--bg-green); transform: translateY(-1px); }
.btn-sm { padding: 9px 16px; }
.btn-lg { padding: 16px 28px; font-size: 16px; }

/* Шапка */
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.logo:hover { text-decoration: none; }
.header-nav { display: flex; align-items: center; gap: 24px; }
.header-nav a { color: var(--ink); font-size: 15px; }
.header-nav a:not(.btn):not(.a11y-header-link) { position: relative; }
.header-nav a:not(.btn):not(.a11y-header-link)::after {
  content: "";
  position: absolute; left: 0; bottom: -5px;
  width: 100%; height: 2px;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.header-nav a:not(.btn):not(.a11y-header-link):hover { text-decoration: none; }
.header-nav a:not(.btn):not(.a11y-header-link):hover::after { transform: scaleX(1); }

/* Hero */
.hero {
  background: radial-gradient(680px 340px at 50% -60px, #e2f3ed 0%, var(--bg-soft) 75%);
  padding: 88px 0 96px;
}
.hero-inner { max-width: 712px; text-align: center; }
.eyebrow {
  font: 500 13px/1 var(--font-mono);
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
}
.hero-sub { color: var(--muted); margin: 20px auto 32px; max-width: 560px; }
.scan-form { display: flex; gap: 10px; max-width: 520px; margin: 0 auto; }
.scan-form input {
  flex: 1;
  font: 400 15px var(--font-mono);
  color: var(--ink);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
}
.scan-form input { transition: box-shadow .2s ease; }
.scan-form input:focus {
  outline: 2px solid var(--green);
  outline-offset: -1px;
  box-shadow: 0 0 0 4px rgba(14, 110, 92, .12);
}
.hero-note { font: 400 12.5px var(--font-mono); color: var(--muted); margin-top: 14px; }
.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 560px;
  margin: 24px auto 0;
}
.hero-facts div {
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.hero-facts span {
  display: block;
  color: var(--green);
  font-size: 18px;
  font-weight: 500;
}
.hero-facts small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

/* Статус проверки */
.scan-status {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 20px; margin-top: 28px;
}
.scan-status-title { font-weight: 500; overflow-wrap: anywhere; }
.scan-status-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.scan-error { border-color: var(--red); background: var(--red-bg); }
.spinner {
  width: 22px; height: 22px; flex: none;
  border: 3px solid var(--border); border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Секции */
.section { padding: 96px 0; }
.section-green { background: var(--bg-green); }
.section-soft { background: var(--bg-soft); }
.section-sub { color: var(--muted); max-width: 540px; margin-bottom: 40px; }
.center .section-sub { margin-left: auto; margin-right: auto; }

/* Карточки «Почему это важно» */
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.cards-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 40px; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 28px; display: flex; flex-direction: column; gap: 14px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(16, 32, 28, .08);
  border-color: #c6d5cf;
}
.card-featured:hover { border-color: var(--green); }
.card p { font-size: 15px; color: var(--ink); flex: 1; }
.card-figure { font-size: 30px; font-weight: 500; }
.card-link { font: 400 12.5px var(--font-mono); }
.audit-card { padding: 22px; }
.audit-card .card-figure { font-size: 24px; }
.audit-card h3 { font-size: 17px; }
.audit-card p { font-size: 14px; }

/* Сравнение подходов */
.comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 40px;
}
.comparison-col {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  background: #fff;
}
.comparison-col-strong {
  border-color: var(--green);
  background: linear-gradient(180deg, #fff 0%, var(--bg-green) 100%);
}
.plain-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}
.plain-list li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  font-size: 15px;
}
.plain-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .7em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.comparison-col-strong .plain-list li::before { background: var(--green); }

/* Шаги */
.steps { list-style: none; display: flex; flex-direction: column; gap: 44px; margin-top: 40px; }
.steps li { display: flex; gap: 28px; }
.step-num { font-size: 28px; font-weight: 500; color: #b5cdc5; line-height: 1.2; min-width: 48px; }
.steps p { color: var(--muted); font-size: 15.5px; max-width: 520px; }

/* Протокол */
.protocol { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.protocol-head {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em;
}
.protocol-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.protocol-table th {
  font: 500 12px var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); text-align: left;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.protocol-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.protocol-table tr:last-child td { border-bottom: none; }
.protocol-table td.mono { font-size: 12.5px; padding-top: 15px; }
.row-fail { background: var(--red-bg); box-shadow: inset 3px 0 0 var(--red); }
.row-details { font-size: 13px; color: var(--muted); margin-top: 4px; }
.protocol-error { padding: 24px 20px; color: var(--muted); }
.protocol-score {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.score-bar { flex: 1; height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.score-fill { display: block; height: 100%; background: var(--green); }
.score-fill.low { background: var(--red); }
.protocol-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.result-protocol { margin-top: 28px; text-align: left; }
.protocol-permalink {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--muted);
}
.protocol-permalink a { overflow-wrap: anywhere; }
.btn-copy {
  font: 500 11px var(--font-mono);
  padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 6px;
  background: none; color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-copy:hover { color: var(--green); border-color: var(--green); }
.btn-copy:disabled { color: var(--green); border-color: var(--border); cursor: default; }

/* Страница протокола /r/{id} */
.report-title { font-size: clamp(28px, 4vw, 40px); margin: 10px 0 24px; overflow-wrap: anywhere; }
.report-actions { margin-top: 28px; }

/* Цены */
.pricing .card { gap: 10px; }
.plan-name { font-weight: 600; font-size: 16px; }
.plan-price { font-size: 34px; font-weight: 500; margin: 6px 0 10px; }
.plan-per { font-size: 13px; color: var(--muted); }
.plan-badge {
  align-self: flex-start;
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--green); background: var(--bg-green);
  padding: 5px 10px; border-radius: 999px;
}
.card-featured { border: 2px solid var(--green); }
.plan-list { list-style: none; flex: 1; display: flex; flex-direction: column; gap: 10px; margin: 6px 0 16px; }
.plan-list li { font-size: 14.5px; padding-left: 26px; position: relative; }
.plan-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 600; }
.pricing .btn { text-align: center; }

/* FAQ */
.faq { display: flex; flex-direction: column; gap: 10px; margin-top: 36px; }
.faq details {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden;
  transition: border-color .2s ease;
}
.faq details:hover { border-color: #c6d5cf; }
.faq details[open] { border-color: var(--green); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 18px 20px; font-weight: 500; font-size: 15.5px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  transition: background .2s ease;
}
.faq summary:hover { background: var(--bg-soft); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details p { padding: 0 20px 18px; color: var(--muted); font-size: 15px; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.a11y) .faq details[open] p { animation: faq-in .28s ease both; }
}
@keyframes faq-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* CTA */
.cta h2 { font-size: clamp(26px, 3.5vw, 34px); }
.cta .btn { margin-top: 8px; }

/* Страница 404 */
.error-404 { background: var(--bg-soft); }
.error-code {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(96px, 18vw, 168px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.error-zero { color: var(--green); }
.ecg { display: block; width: min(520px, 100%); margin: 0 auto 32px; overflow: visible; }
.ecg path {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: ecg-draw 3.6s linear infinite;
}
.ecg-dot {
  fill: var(--green);
  animation: ecg-dot 3.6s linear infinite;
}
@keyframes ecg-draw {
  0%   { stroke-dashoffset: 100; opacity: 1; }
  62%  { stroke-dashoffset: 0; opacity: 1; }
  90%  { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes ecg-dot {
  0%, 55% { opacity: 0; }
  62%     { opacity: 1; }
  76%     { opacity: 0.2; }
  90%     { opacity: 1; }
  100%    { opacity: 0; }
}
.error-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) {
  .ecg path { animation: none; stroke-dashoffset: 0; }
  .ecg-dot { animation: none; }
}
/* В режиме для слабовидящих анимации выключены — линия должна быть видна целиком */
html.a11y .ecg path { stroke-dashoffset: 0; }

/* ЭКГ-линия в hero */
.ecg-hero { width: 220px; margin: 30px auto 0; opacity: .85; }
.ecg-hero path { animation-duration: 4.2s; }
.ecg-hero .ecg-dot { animation-duration: 4.2s; }

/* Подвал */
.site-footer { border-top: 1px solid var(--border); padding: 56px 0 32px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-brand { font-weight: 600; margin-bottom: 12px; }
.footer-requisites { font: 400 12.5px/1.7 var(--font-mono); color: var(--muted); }
.footer-heading {
  font: 500 12px var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 14px;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 14px; color: var(--ink); }
.footer-bottom {
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
  font: 400 12px var(--font-mono); color: var(--muted);
}

/* ===== Версия для слабовидящих (приказ 118н, ГОСТ Р 52872) ===== */

/* Размер шрифта: единый кегль через переменную, заголовки — кратно ей */
html.a11y-font-1 { --a11y-fs: 20px; }
html.a11y-font-2 { --a11y-fs: 24px; }
html.a11y-font-3 { --a11y-fs: 28px; }

/* Единый рубленый шрифт, отключение анимаций и теней */
html.a11y *,
html.a11y *::before,
html.a11y *::after {
  font-family: Arial, "Helvetica Neue", sans-serif !important;
  font-size: var(--a11y-fs) !important;
  line-height: 1.6 !important;
  letter-spacing: 0.01em !important;
  animation: none !important;
  transition: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
html.a11y h1 { font-size: calc(var(--a11y-fs) * 1.8) !important; }
html.a11y h2 { font-size: calc(var(--a11y-fs) * 1.5) !important; }
html.a11y h3 { font-size: calc(var(--a11y-fs) * 1.2) !important; }

html.a11y a { text-decoration: underline !important; }
html.a11y :focus { outline: 3px solid currentColor !important; outline-offset: 2px; }
html.a11y .btn { border-width: 2px !important; border-style: solid !important; }

/* Цветовые схемы */
html.a11y-scheme-white,
html.a11y-scheme-white body { background: #fff !important; color: #000 !important; }
html.a11y-scheme-white * { background-color: #fff !important; color: #000 !important; border-color: #000 !important; }

html.a11y-scheme-dark,
html.a11y-scheme-dark body { background: #000 !important; color: #fff !important; }
html.a11y-scheme-dark * { background-color: #000 !important; color: #fff !important; border-color: #fff !important; }

html.a11y-scheme-blue,
html.a11y-scheme-blue body { background: #9dd1ff !important; color: #063462 !important; }
html.a11y-scheme-blue * { background-color: #9dd1ff !important; color: #063462 !important; border-color: #063462 !important; }

/* Отключение изображений */
html.a11y-noimg img,
html.a11y-noimg picture,
html.a11y-noimg video,
html.a11y-noimg iframe { display: none !important; }

/* Панель настроек */
.a11y-panel { border-bottom: 2px solid; padding: 12px 0; }
.a11y-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; }
.a11y-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.a11y-btn {
  cursor: pointer;
  border: 2px solid currentColor;
  background: none;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 12px;
}
.a11y-btn[aria-pressed="true"] {
  outline: 3px solid currentColor;
  outline-offset: 1px;
  text-decoration: underline;
}

/* Демонстрационные цвета и кегли кнопок панели — поверх схемных правил */
.a11y-panel .a11y-fs-1 { font-size: 16px !important; }
.a11y-panel .a11y-fs-2 { font-size: 22px !important; }
.a11y-panel .a11y-fs-3 { font-size: 28px !important; }
.a11y-panel .a11y-sw-white { background-color: #fff !important; color: #000 !important; border-color: #000 !important; }
.a11y-panel .a11y-sw-dark { background-color: #000 !important; color: #fff !important; border-color: #fff !important; }
.a11y-panel .a11y-sw-blue { background-color: #9dd1ff !important; color: #063462 !important; border-color: #063462 !important; }

/* Ссылка в шапке видима только глазом-иконкой, текст — для скринридера и сканера */
.a11y-header-link { display: inline-flex; align-items: center; color: var(--ink); }
.a11y-header-link svg { display: block; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Адаптив */
@media (max-width: 900px) {
  .cards-3 { grid-template-columns: 1fr; }
  .cards-4 { grid-template-columns: repeat(2, 1fr); }
  .comparison { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
  .hero { padding: 56px 0 64px; }
  .protocol-table { display: block; overflow-x: auto; }
}
@media (max-width: 560px) {
  .scan-form { flex-direction: column; }
  .hero-facts { grid-template-columns: 1fr; }
  .cards-4 { grid-template-columns: 1fr; }
  .header-nav a:not(.btn) { display: none; }
  .steps li { gap: 16px; }
}

/* ===== Оживление: появление при прокрутке и микроанимации ===== */

html { scroll-padding-top: 76px; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Класс reveal-ready ставит reveal.js — без JS и в режиме
   для слабовидящих контент виден сразу */
html.reveal-ready:not(.a11y) .reveal,
html.reveal-ready:not(.a11y) .reveal-group > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .3, 1);
}
html.reveal-ready:not(.a11y) .reveal.is-visible,
html.reveal-ready:not(.a11y) .reveal-group.is-visible > * {
  opacity: 1;
  transform: none;
}
html.reveal-ready:not(.a11y) .reveal-group.is-visible > :nth-child(2) { transition-delay: .1s; }
html.reveal-ready:not(.a11y) .reveal-group.is-visible > :nth-child(3) { transition-delay: .2s; }
html.reveal-ready:not(.a11y) .reveal-group.is-visible > :nth-child(4) { transition-delay: .3s; }
html.reveal-ready:not(.a11y) .reveal-group.is-visible > :nth-child(5) { transition-delay: .4s; }
html.reveal-ready:not(.a11y) .reveal-group.is-visible > :nth-child(6) { transition-delay: .5s; }

/* Каскадный вход hero при загрузке */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  html:not(.a11y) .hero .eyebrow,
  html:not(.a11y) .hero h1,
  html:not(.a11y) .hero .hero-sub,
  html:not(.a11y) .hero .scan-form,
  html:not(.a11y) .hero .hero-note,
  html:not(.a11y) .hero .hero-facts,
  html:not(.a11y) .hero .ecg-hero { animation: rise .6s cubic-bezier(.2, .7, .3, 1) both; }
  html:not(.a11y) .hero h1 { animation-delay: .08s; }
  html:not(.a11y) .hero .hero-sub { animation-delay: .16s; }
  html:not(.a11y) .hero .scan-form { animation-delay: .24s; }
  html:not(.a11y) .hero .hero-note { animation-delay: .32s; }
  html:not(.a11y) .hero .hero-facts { animation-delay: .4s; }
  html:not(.a11y) .hero .ecg-hero { animation-delay: .48s; }
}

/* Протокол «распечатывается» построчно, как результаты анализов.
   Пример на главной — при попадании в зону видимости,
   живой результат из htmx — сразу после вставки */
@keyframes row-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  html.reveal-ready:not(.a11y) .protocol.reveal tbody tr { opacity: 0; }
  html.reveal-ready:not(.a11y) .protocol.reveal.is-visible tbody tr {
    animation: row-in .45s ease both;
    animation-delay: calc(.07s * var(--i, 0));
  }
  html:not(.a11y) .result-protocol { animation: rise .45s ease both; }
  html:not(.a11y) .result-protocol tbody tr {
    animation: row-in .45s ease both;
    animation-delay: calc(.07s * var(--i, 0));
  }
}

/* Шкала соответствия заполняется слева направо */
@media (prefers-reduced-motion: no-preference) {
  html:not(.a11y) .score-fill {
    transform-origin: left;
    animation: score-grow .9s cubic-bezier(.2, .7, .3, 1) .2s both;
  }
}
@keyframes score-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ===== Модальное окно контактов ===== */

.contact-modal {
  /* глобальный сброс * { margin: 0 } убирает центрирование dialog — возвращаем */
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-shadow: 0 24px 64px rgba(16, 32, 28, .18);
}
.contact-modal::backdrop { background: rgba(16, 32, 28, .45); }
/* Пока модалка открыта, страница под ней не прокручивается */
html:has(.contact-modal[open]) { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.a11y) .contact-modal[open] { animation: rise .35s cubic-bezier(.2, .7, .3, 1) both; }
}

.contact-inner { padding: 26px 28px 24px; }
.contact-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.contact-head h3 { font-family: var(--font-serif); font-size: 22px; letter-spacing: -0.01em; }
.contact-close {
  cursor: pointer;
  border: 0; background: none;
  font-size: 18px; line-height: 1;
  color: var(--muted);
  padding: 4px;
}
.contact-close:hover { color: var(--ink); }
.contact-sub { font-size: 14.5px; color: var(--muted); margin: 8px 0 18px; }

.contact-list { list-style: none; display: grid; gap: 10px; }
.contact-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.contact-item:hover { border-color: var(--green); background: var(--bg-green); transform: translateY(-1px); }
.contact-link {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 0;
  padding: 12px 14px;
  color: var(--ink);
}
.contact-icon { display: flex; flex: none; color: var(--green); }
.contact-icon-max {
  width: 20px; height: 20px;
  align-items: center; justify-content: center;
  border: 2px solid currentColor; border-radius: 6px;
  font-size: 11px; font-weight: 500;
}
.contact-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contact-text b { font-weight: 600; font-size: 15px; }
.contact-text small { font: 400 12.5px var(--font-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.contact-copy {
  cursor: pointer;
  flex: none;
  margin-right: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff;
  font-size: 12px;
  padding: 6px 10px;
  color: var(--green);
}
.contact-copy:hover { border-color: var(--green); }
.contact-note { font-size: 12px; color: var(--muted); margin-top: 16px; }
