/*
 * SITE.CSS — лендинг ES "HOSH" / ХО «ХОШ»
 * ------------------------------------------------------------------
 * Первый экран — тёмный «негатоскоп» с рентгеновской фигурой.
 * Дальше страница светлая и сдержанная: одна сетка, одинаковые поля,
 * две колонки равной ширины.
 * Все цвета и размеры — переменные ниже; правьте их здесь.
 * ------------------------------------------------------------------
 */

:root {
  /* Светлая часть */
  --paper: #ffffff;
  --paper-2: #f3f6f5;
  --ink: #0c1d18;
  --muted: #4c5f58;
  --line: #dce4e0;
  --brand: #0d4d3c;          /* зелёный логотипа */
  --accent: #c1272d;         /* красный монограммы: главное действие */
  --accent-press: #a11f25;

  /* Негатоскоп */
  --film: #04130f;
  --film-ink: #e6f5ef;
  --film-muted: #a3bfb5;
  --xray: #8ff2cc;           /* свечение снимка */
  --bone: #e9fff6;

  --font: 'Onest', 'Segoe UI', Arial, sans-serif;

  /* Шкала текста */
  --t-small: 0.875rem;
  --t-body: 1.0625rem;
  --t-lead: clamp(1.125rem, 1rem + 0.4vw, 1.3125rem);
  --t-h3: 1.1875rem;
  --t-h2: clamp(2rem, 1.4rem + 2vw, 3rem);
  --t-h1: clamp(2.5rem, 1.6rem + 3vw, 3.875rem);

  --container: 1240px;
  --gutter: clamp(20px, 4vw, 40px);
  --section: clamp(88px, 10vw, 144px);
  --header-h: 76px;
  --radius: 10px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-underline-offset: 0.2em; }

h1, h2 { font-weight: 500; letter-spacing: -0.03em; line-height: 1.06; text-wrap: balance; }
h3 { font-size: var(--t-h3); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }

::selection { background: var(--xray); color: var(--film); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 20;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.15s var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-press); }
.btn-ghost { border-color: rgba(230, 245, 239, 0.35); color: var(--film-ink); }
.btn-ghost:hover { border-color: var(--film-ink); }

/* ==================================================================
   ШАПКА: прозрачная над рентгеном, белая ниже
   ================================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: var(--header-h);
  color: var(--film-ink);
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}
.site-header.is-solid {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
}

.header-row {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
  justify-self: start;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark img { width: 30px; height: 30px; }

.site-nav { display: flex; gap: 36px; }
.site-nav a,
.footer-nav a { text-decoration: none; opacity: 0.86; transition: opacity 0.2s; }
.site-nav a:hover,
.footer-nav a:hover { opacity: 1; text-decoration: underline; }

.header-mail { justify-self: end; text-decoration: none; font-weight: 500; opacity: 0.86; transition: opacity 0.2s; }
.header-mail:hover { opacity: 1; text-decoration: underline; }

/* Сколько страницы прочитано: мятная над снимком, зелёная на белом */
.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--xray);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
.site-header.is-solid .scroll-progress { background: var(--brand); }

/* ==================================================================
   ГЕРОЙ: негатоскоп
   ================================================================== */
.hero {
  background: var(--film);
  color: var(--film-ink);
  min-height: 100svh;
  padding-top: var(--header-h);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 40px;
}

.hero-copy { padding: 48px 0; }
.hero h1 { font-size: var(--t-h1); }
.hero-lead { margin-top: 28px; font-size: var(--t-lead); color: var(--film-muted); max-width: 34em; }
.hero-actions { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 12px; }

/* Фигура прижата к левому краю колонки: справа от неё место для подписи */
.hero-visual { position: relative; display: flex; flex-direction: column; align-items: flex-start; }

/* Фигура: высота от экрана, ширина по пропорциям viewBox 600×1000 */
.figure {
  position: relative;
  height: min(calc(100svh - var(--header-h) - 140px), 780px);
  aspect-ratio: 6 / 10;
}
.xray { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.xray .body { fill: #0a2a22; }
.xray .body-edge { fill: none; stroke: var(--xray); stroke-width: 1.4; opacity: 0.55; }

.xray .bones,
.xray .bones * { fill: none; stroke: var(--bone); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.xray .bones rect { fill: rgba(233, 255, 246, 0.06); }
.xray .lungs path { fill: rgba(143, 242, 204, 0.08); stroke: var(--xray); stroke-width: 1.4; }
/* В покое органы едва видны: главный на снимке — скелет */
.xray .organ > * { fill: rgba(143, 242, 204, 0.08); stroke: var(--xray); stroke-opacity: 0.5; stroke-width: 1.4; transition: fill 0.5s, stroke-width 0.5s, stroke-opacity 0.5s; }
.xray .organ .detail { fill: none; }

/* Вне полосы снимок тусклый, в полосе — яркий. Выбранный орган ярок всегда. */
.xray .layer-dim .bones,
.xray .layer-dim .lungs,
.xray .layer-dim .organ:not(.is-on) { opacity: 0.32; }
.xray .layer-lit .bones,
.xray .layer-lit .bones * { stroke-width: 2.4; }
.xray .beam-fill { fill: rgba(143, 242, 204, 0.07); }
.xray .beam-line { fill: var(--xray); opacity: 0.8; }

.xray .organ.is-on > * { fill: rgba(143, 242, 204, 0.5); stroke-opacity: 1; stroke-width: 2.4; }
.xray .organ.is-on .detail { fill: none; stroke: #fff; }

/* Кольцо-мишень */
/* Кольцо и подпись двигает js/site.js вместе с полосой сканирования */
.xray .target { transition: opacity 0.4s; }
.xray .ring { fill: none; stroke: #fff; stroke-width: 2.4; }
.xray .ring-outer {
  stroke: var(--xray);
  stroke-width: 3.4;
  stroke-dasharray: 0 9;
  stroke-linecap: round;
  transform-origin: 0 0;
  animation: ring-pulse 2.2s ease-in-out infinite;
}
.xray .dot { fill: #fff; }

@keyframes ring-pulse {
  0%, 100% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.55; }
}

/* Подпись: линия от кольца и название направления */
.callout {
  position: absolute;
  left: 50%;
  top: 8%;
  display: flex;
  align-items: center;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity 0.4s;
}
.callout-line {
  width: var(--line-w, 120px);
  height: 1px;
  background: var(--xray);
  opacity: 0.7;
}
.callout-text {
  display: grid;
  gap: 2px;
  padding-left: 14px;
  width: 210px;
  line-height: 1.35;
  transition: opacity 0.3s;
}
.callout-text strong { font-weight: 600; font-size: 1.0625rem; color: #fff; }
.callout-text span { font-size: var(--t-small); color: var(--film-muted); }
.callout.is-switching .callout-text { opacity: 0; }

.scan-toggle {
  position: absolute;
  left: 50%;
  bottom: -52px;
  transform: translateX(-50%);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-size: var(--t-small);
  color: var(--film-muted);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.scan-toggle:hover { color: var(--film-ink); background: rgba(143, 242, 204, 0.08); }
/* Значок паузы — две полоски; на паузе — треугольник «пуск» */
.scan-icon {
  width: 10px;
  height: 12px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
.scan-toggle[aria-pressed="true"] .scan-icon {
  width: 0;
  height: 0;
  border-right: 0;
  border-left: 10px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* ==================================================================
   СЕКЦИИ
   ================================================================== */
.section { padding: var(--section) 0; }
.section-alt { background: var(--paper-2); }
/* Две белые секции подряд: одна линия вместо двойного отступа */
.section + .section { padding-top: 0; }
.section + .section > .container {
  padding-top: var(--section);
  /* линия по ширине текста, без боковых полей контейнера */
  background: linear-gradient(var(--line), var(--line)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}

.lead { font-size: var(--t-lead); color: var(--muted); line-height: 1.55; }

/* Две равные колонки */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 80px;
  align-items: start;
}
.split h2 { font-size: var(--t-h2); max-width: 14em; }
.split-head .lead { margin-top: 24px; max-width: 32em; }

/* Факты о компании: сетка 2×2 */
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}
.facts > div {
  position: relative;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
/* Этапы идут по порядку: при появлении блока полоса проходит их один за другим */
.facts > div::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: var(--brand);
  transform-origin: left;
  transition: transform 0.7s var(--ease-out);
}
.js .facts:not(.is-run) > div::before { transform: scaleX(0); }
.facts > div:nth-child(2)::before { transition-delay: 0.45s; }
.facts > div:nth-child(3)::before { transition-delay: 0.9s; }
.facts > div:nth-child(4)::before { transition-delay: 1.35s; }
.facts > div:nth-child(odd) { padding-right: 32px; }
.facts > div:nth-child(even) { padding-left: 32px; border-left: 1px solid var(--line); }
.facts dt { font-weight: 600; font-size: var(--t-h3); }
.facts dd { margin-top: 8px; color: var(--muted); }

/* Направления: ровная таблица 4×4 */
.section-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 80px;
  align-items: end;
  margin-bottom: 56px;
}
.section-head h2 { font-size: var(--t-h2); }

/* ==================================================================
   СТРАНИЦА «SPECIALTIES»
   ================================================================== */
.page-head { padding: calc(var(--header-h) + clamp(56px, 7vw, 104px)) 0 clamp(40px, 5vw, 64px); }
.page-head h1 { font-size: var(--t-h1); }
.page-head .section-head { margin-bottom: 0; }
.section-tight { padding-bottom: var(--section); }

/* Ровная сетка 4 × 4: фото 4:3, название, оборудование */
.spec-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 48px 24px;
}
.spec-cards img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--paper-2);
}
.spec-cards h2 {
  margin-top: 18px;
  font-size: var(--t-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  hyphens: auto;
  overflow-wrap: break-word;
}
.spec-cards p { margin-top: 6px; color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }

/* Призыв внизу страницы */
.cta { background: var(--paper-2); }
.cta-row { display: flex; align-items: center; justify-content: space-between; gap: 24px 48px; flex-wrap: wrap; }
.cta h2 { font-size: var(--t-h2); max-width: 16em; }

.site-nav a[aria-current="page"] { opacity: 1; text-decoration: underline; }

/* Контакты */
.contact-list { margin-top: 40px; border-top: 1px solid var(--line); }
.contact-list li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.contact-list li > span:first-child { color: var(--muted); }
.contact-list a { color: var(--brand); font-weight: 500; text-decoration: none; }
.contact-list a:hover { text-decoration: underline; }

.form {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 40px;
  background: var(--paper-2);
  border-radius: var(--radius);
}
.field { display: grid; gap: 8px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: var(--t-small); font-weight: 500; }
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 50px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:hover,
.field textarea:hover { border-color: #b9c8c1; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 77, 60, 0.15); }
.field [aria-invalid="true"] { border-color: var(--accent); }
.form-error { color: var(--accent); font-size: var(--t-small); }
.form .btn { width: 100%; }
.form .btn:disabled { opacity: 0.6; cursor: progress; }
.form-error a { color: inherit; font-weight: 500; }

/* Пока заявка уходит, по форме сверху вниз идёт скан */
.form::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -140px;
  height: 140px;
  background: linear-gradient(rgba(13, 77, 60, 0), rgba(13, 77, 60, 0.1));
  border-bottom: 2px solid var(--brand);
  pointer-events: none;
}
.form.is-sending::after { animation: form-scan 1.2s ease-in-out infinite; }
@keyframes form-scan { to { top: 100%; } }

/* Ловушка для ботов — вне экрана, но не display:none, иначе боты её пропускают */
.botcheck { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* После отправки вместо полей — сообщение об успехе */
.form.is-done > :not(.form-done) { display: none; }
.form-done { padding: 24px 0; }
.form-done:focus { outline: none; }
/* Отправлено: кардиограмма переходит в галочку */
.done-pulse { display: block; width: 220px; height: 60px; margin-bottom: 28px; overflow: visible; }
.done-pulse path {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  animation: draw 1.2s var(--ease-out) both;
}
@keyframes draw { from { stroke-dashoffset: 1; } }
.form-done h3 { font-size: var(--t-h2); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.form-done p { margin-top: 16px; color: var(--muted); font-size: var(--t-lead); }

/* ==================================================================
   ФУТЕР
   ================================================================== */
.site-footer { background: var(--film); color: var(--film-ink); padding: 56px 0 32px; }

/* Знак и кардиограмма по центру: ровная линия, один удар под знаком */
.footer-pulse { display: grid; justify-items: center; gap: 16px; margin-bottom: 48px; }
.footer-emblem {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.footer-emblem img { width: 48px; height: 48px; }
/* Знак один раз «просвечивают» */
.footer-emblem::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(143, 242, 204, 0), rgba(143, 242, 204, 0.55) 80%, var(--xray));
  transform: translateY(-100%);
  pointer-events: none;
}
.site-footer.is-run .footer-emblem::after { animation: emblem-scan 1.6s 0.2s ease-in-out both; }
@keyframes emblem-scan { to { transform: translateY(100%); } }

.pulse { width: 100%; display: flex; align-items: flex-start; }
.pulse-flat {
  flex: 1;
  height: 1.5px;
  margin-top: 39.25px;
  background: var(--xray);
  opacity: 0.5;
  transition: transform 0.8s var(--ease-out);
}
.pulse-flat-l { transform-origin: left; }
.pulse-flat-r { transform-origin: left; transition-delay: 1.2s; }
.pulse-beat {
  flex: none;
  width: 160px;
  height: 60px;
  overflow: visible;
  filter: drop-shadow(0 0 4px rgba(143, 242, 204, 0.6));
  transition: clip-path 0.6s ease-in 0.7s;
}
.pulse-beat path {
  fill: none;
  stroke: var(--xray);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
/* Каждая волна (P, QRS, T) вздрагивает от линии; следующая — через 0,5 с */
.pulse-beat .wave { transform-origin: 0 40px; }
.site-footer.is-run .wave { animation: wave-shake 1.5s ease-out 1.4s infinite; }
.site-footer.is-run .wave-qrs { animation-delay: 1.9s; }
.site-footer.is-run .wave-t { animation-delay: 2.4s; }
@keyframes wave-shake {
  0%, 30%, 100% { transform: scaleY(1); }
  6% { transform: scaleY(1.45); }
  12% { transform: scaleY(0.7); }
  18% { transform: scaleY(1.2); }
  24% { transform: scaleY(0.92); }
}
.js .site-footer:not(.is-run) .pulse-flat { transform: scaleX(0); }
.js .site-footer:not(.is-run) .pulse-beat { clip-path: inset(-20px 100% -20px 0); }
.site-footer.is-run .pulse-beat { clip-path: inset(-20px 0 -20px 0); }

.footer-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}
.footer-nav { display: flex; gap: 32px; }
.footer-mail { justify-self: end; color: var(--xray); text-decoration: none; font-weight: 500; }
.footer-mail:hover { text-decoration: underline; }
.footer-legal {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(230, 245, 239, 0.12);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: var(--t-small);
  color: var(--film-muted);
}

/* ==================================================================
   ВХОД ПЕРВОГО ЭКРАНА — единственная постановочная анимация
   ================================================================== */
.js .hero-copy > * { animation: rise 0.9s var(--ease-out) both; }
.js .hero-copy > :nth-child(2) { animation-delay: 90ms; }
.js .hero-copy > :nth-child(3) { animation-delay: 180ms; }
.js .figure { animation: develop 1.6s var(--ease-out) both; }

@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
/* Снимок «проявляется», как плёнка в негатоскопе */
@keyframes develop { from { opacity: 0; filter: blur(6px); } }

/* ==================================================================
   ПЛАНШЕТ И ТЕЛЕФОН
   ================================================================== */
@media (max-width: 1080px) {
  .callout-text { width: 170px; }
  .spec-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --header-h: 64px; }
  .header-row { grid-template-columns: 1fr auto; }
  .site-nav { display: none; }
  .header-mail { font-size: var(--t-small); }

  .hero { min-height: 0; display: block; }
  .hero-grid { grid-template-columns: 1fr; gap: 0; }
  .hero-copy { padding: 40px 0 8px; max-width: none; }
  .hero-visual { padding: 24px 0 140px; align-items: center; }
  .figure { height: auto; width: min(64vw, 340px); }
  /* На телефоне подпись и кнопка паузы — под фигурой, без линии */
  .callout {
    left: -20vw !important;
    right: -20vw;
    top: calc(100% + 20px) !important;
    transform: none;
    justify-content: center;
    transition: none;
  }
  .callout-line { display: none; }
  .callout-text { padding: 0; width: auto; text-align: center; }
  .scan-toggle { bottom: -124px; }
  .js .figure { animation: none; }

  .split,
  .section-head { grid-template-columns: 1fr; gap: 32px; }
  .section-head { margin-bottom: 40px; }
  .spec-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; }
  .spec-cards h2 { margin-top: 12px; }

  .form { padding: 24px; grid-template-columns: 1fr; }
  .contact-list li { grid-template-columns: 90px 1fr; }

  .footer-row { grid-template-columns: 1fr; justify-items: start; }
  .footer-mail { justify-self: start; }
  .footer-legal { flex-direction: column; }
}

@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; }
  .facts > div:nth-child(odd),
  .facts > div:nth-child(even) { padding: 22px 0; border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
