/* First block: four-slide hero. Scoped to .hs, the rest of the page is the current preview */
/* Loaded before design-tokens.css: preserve its existing important-layer order. */
@layer appearance-controls, design-system;
.hs-wrap { --hs-forest: #10231d; --hs-green: #1f5546; --hs-coral: #b65334; --hs-coral-dark: #9c4429; --hs-milk: #f7f3ec; --hs-fade: 1.2s; }
.hs {
  position: relative;
  display: flex;
  align-items: flex-end;
  /* Full window height on every screen; 100vh first for browsers without svh */
  height: 100vh;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
  background: var(--hs-forest);
  color: #fff;
}

/* Media layers: poster image under each video, crossfade by opacity only */
.hs-stage { position: absolute; inset: 0; z-index: -2; }
.hs-media { position: absolute; inset: 0; opacity: 0; transition: opacity var(--hs-fade) ease; }
.hs-media.is-active { opacity: 1; }
/* Public CSP blocks inline style attributes. Keep the accepted focal positions
   in the external stylesheet so the real page uses them on every slide. */
.hs-media:nth-child(1) { --hs-pos: 58% 40%; --hs-pos-m: 50% 45%; }
.hs-media:nth-child(2) { --hs-pos: 42% 30%; --hs-pos-m: 36% 40%; }
.hs-media:nth-child(3) { --hs-pos: 50% 32%; --hs-pos-m: 74% 40%; }
.hs-media:nth-child(4) { --hs-pos: 50% 40%; --hs-pos-m: 73% 40%; }
.hs-media:nth-child(2) .hs-video,
.hs-media:nth-child(2) .hs-poster { transform: scaleX(-1); }
.hs-poster, .hs-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--hs-pos, 50% 40%);
}
.hs-video { opacity: 0; transition: opacity .6s ease; }
.hs-media.is-playing .hs-video { opacity: 1; }
.hs-media.is-failed .hs-video { display: none; }

/* Scrim: dark green from the bottom-left for the copy, light band on top for the white header */
.hs::after {
  content: "";
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 30, 24, .38) 0%, rgba(10, 30, 24, 0) 22%),
    linear-gradient(90deg, rgba(10, 30, 24, .4) 0%, rgba(10, 30, 24, .16) 40%, rgba(10, 30, 24, 0) 66%),
    linear-gradient(0deg, rgba(10, 30, 24, .78) 0%, rgba(10, 30, 24, .34) 32%, rgba(10, 30, 24, 0) 62%);
}

.hs-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 40px 56px;
  /* Same edges as the header bar: its outer margin plus its inner padding */
  box-sizing: border-box;
  /* Text starts at the left edge of the menu bar and the page grid (1320 px, 32 px margins) */
  width: min(100% - 64px, 1320px);
  margin: 0 auto;
  padding: 180px 0 clamp(40px, 6vh, 72px);
  will-change: transform;
}

/* All slides share one grid cell: the block keeps the height of the tallest slide */
.hs-slides { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.hs-slide {
  grid-area: 1 / 1;
  align-self: end;
  min-width: 0;
  max-width: 1040px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .8s ease, transform .8s ease, visibility 0s linear .8s;
}
.hs-slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .9s ease .25s, transform .9s ease .25s, visibility 0s;
}

.hs .hs-title {
  margin: 0 0 24px;
  color: #fff;
  font-family: var(--hs-font-title, var(--font-heading), "Source Serif 4", Georgia, serif);
  font-size: clamp(44px, 4.7vw, 88px) !important; /* typography-standard.css sets h1 with !important */
  font-weight: var(--hs-weight-title, 400);
  line-height: 1;
  letter-spacing: -.025em;
  text-wrap: initial;
}
.hs .hs-title span { display: block; white-space: nowrap; }
.hs .hs-lead, .hs .hs-text {
  max-width: 680px;
  margin: 0 0 32px;
  color: rgba(255, 255, 255, .9);
  font-family: var(--font-sans, "Golos Text", Arial, sans-serif);
  font-size: clamp(17px, 1.12vw, 20px);
  line-height: 1.45;
}
.hs-nowrap { white-space: nowrap; }

.hs .hs-stat { display: flex; align-items: flex-end; gap: 24px; margin: 0 0 24px; color: #fff; }
.hs .hs-stat strong {
  font-family: var(--hs-font-title, var(--font-heading, "Source Serif 4", Georgia, serif));
  font-size: clamp(84px, 8vw, 148px);
  font-weight: var(--hs-weight-title, 400);
  line-height: .78;
  letter-spacing: -.045em;
}
.hs .hs-stat > span {
  max-width: 9.5em;
  padding-bottom: .1em;
  font-family: var(--hs-font-title, var(--font-heading, "Source Serif 4", Georgia, serif));
  font-size: clamp(22px, 1.85vw, 34px);
  font-style: var(--hs-label-style, italic);
  font-weight: var(--hs-weight-label, 400);
  line-height: 1.05;
}

/* «Наш подход» is one heading, rather than a metric with a small caption. */
html body .hs .hs-stat.hs-stat--word {
  --hs-word-size: clamp(64px, 6vw, 112px);
  font-size: var(--hs-word-size);
  align-items: baseline;
  flex-wrap: wrap;
  gap: .12em .22em;
}
html body .hs .hs-stat.hs-stat--word > :is(strong, span) {
  line-height: 1;
  max-width: 100%;
  padding-bottom: 0;
  white-space: nowrap;
}
/* Important declarations must share the existing design-system layer; an
   unlayered !important cannot beat that layer, even with higher specificity. */
@layer design-system {
  html body .hs .hs-stat.hs-stat--word > :is(strong, span) {
    font-size: var(--hs-word-size) !important;
    letter-spacing: -.03em !important;
  }
}

.hs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 16px; }
.hs .hs-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: clamp(48px, 3.4vw, 54px); padding: 0 clamp(22px, 1.6vw, 28px);
  border: 1px solid transparent; border-radius: 999px;
  font: 500 16px/1.2 var(--font-sans, "Golos Text", Arial, sans-serif);
  text-decoration: none; white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.hs .hs-btn--primary { background: var(--hs-coral); color: #fff; box-shadow: 0 14px 30px rgba(60, 30, 18, .22); }
.hs .hs-btn--primary:hover { background: var(--hs-coral-dark); }
.hs .hs-btn--ghost { border-color: rgba(255, 255, 255, .72); background: rgba(255, 255, 255, .08); color: #fff; }
.hs .hs-btn--ghost:hover { background: rgba(255, 255, 255, .18); }
.hs .hs-link {
  display: inline-flex; align-items: center; min-height: clamp(48px, 3.4vw, 54px); padding: 0 6px;
  color: #fff; font: 500 16px/1.2 var(--font-sans, "Golos Text", Arial, sans-serif);
  text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .5); text-underline-offset: 5px;
}
.hs .hs-link:hover { text-decoration-color: #fff; }
.hs a:focus-visible, .hs button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Controls: kept quiet so they do not compete with the copy. One compact row on the
   baseline of the buttons: thin numbered indicators with an 8 s line, small outline buttons */
.hs-controls { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; opacity: .78; transition: opacity .25s ease; }
.hs-controls:hover, .hs-controls:focus-within { opacity: 1; }
.hs-dots { display: flex; gap: 8px; }
.hs-dot {
  display: grid; gap: 7px; width: 34px; padding: 10px 0; border: 0; background: none;
  color: rgba(255, 255, 255, .55); font: 500 11px/1 var(--font-sans, "Golos Text", Arial, sans-serif);
  letter-spacing: .08em; text-align: left; cursor: pointer;
}
.hs-dot.is-active, .hs-dot:hover { color: #fff; }
.hs-dot__bar { position: relative; display: block; height: 2px; overflow: hidden; background: rgba(255, 255, 255, .28); border-radius: 2px; }
.hs-dot__bar i { position: absolute; inset: 0; background: #fff; transform: scaleX(0); transform-origin: left center; }
.hs-dot.is-done .hs-dot__bar i { transform: scaleX(1); opacity: .5; }
.hs-buttons { display: flex; gap: 6px; }
.hs-round {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  border: 1px solid rgba(255, 255, 255, .34); border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.hs-round:hover { border-color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .1); }
.hs-round svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hs-round .hs-icon-play { display: none; fill: currentColor; stroke: none; }
.hs.is-paused .hs-icon-pause { display: none; }
.hs.is-paused .hs-icon-play { display: block; }

@media (max-width: 900px) {
  .hs-inner { grid-template-columns: minmax(0, 1fr); gap: 26px; padding-top: 150px; padding-bottom: 32px; }
  .hs-controls { justify-content: space-between; }
}

@media (max-width: 600px) {
  .hs { min-height: 0; }
  .hs-poster, .hs-video { object-position: var(--hs-pos-m, 50% 40%); }
  .hs::after {
    background:
      linear-gradient(180deg, rgba(10, 30, 24, .28) 0%, rgba(10, 30, 24, 0) 24%),
      linear-gradient(0deg, rgba(10, 30, 24, .86) 0%, rgba(10, 30, 24, .7) 28%, rgba(10, 30, 24, .2) 60%, rgba(10, 30, 24, 0) 78%);
  }
  .hs-inner { width: calc(100% - 32px); padding: 100px 0 max(20px, env(safe-area-inset-bottom)); gap: 16px; }
  /* «Психическое здоровье» always stays on one line; the rest may break before «с понимания» */
  /* Size is fitted by hero.js so that «Психическое здоровье» fills one line for any font */
  .hs .hs-title { font-size: calc((100vw - 32px) / 11.4) !important; margin-bottom: 20px; line-height: 1.04; }
  .hs .hs-title .hs-title__rest { white-space: normal; }
  .hs .hs-lead, .hs .hs-text { font-size: 16px; margin-bottom: 26px; }
  .hs .hs-stat { gap: 16px; margin-bottom: 22px; }
  .hs .hs-stat strong { font-size: clamp(60px, 19vw, 96px); }
  .hs .hs-stat > span { font-size: clamp(18px, 5.6vw, 26px); }
  html body .hs .hs-stat.hs-stat--word { --hs-word-size: clamp(40px, 10vw, 60px); }
  .hs-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hs .hs-btn { width: 100%; white-space: normal; text-align: center; }
  .hs .hs-link { justify-content: center; min-height: 44px; }
  .hs-controls { gap: 12px; }
  .hs-dots { gap: 6px; }
  .hs-dot { width: 30px; padding: 8px 0; }
  .hs-buttons { gap: 8px; }
  .hs-round { width: 40px; height: 40px; }

}

@media (max-width: 360px) {
  .hs .hs-stat { gap: 12px; }
  .hs-dot { width: 26px; }
  .hs-round { width: 40px; height: 40px; }
}

/* Mobile hero controls: a viewport scene with a compact row. Short windows
   may grow with content so neither header nor copy is clipped. */
@media (max-width: 900px) {
  html body.home .hs-wrap { position: relative; }
  html body.home .hs { height: auto; min-height: 100vh; min-height: 100svh; overflow: visible; }
  .hs-inner { gap: 16px; }
}
@media (max-width: 900px) and (max-height: 650px) {
  .hs-inner { padding-top: 96px; padding-bottom: 16px; gap: 8px; }
  .hs .hs-title { margin-bottom: 12px; }
  .hs .hs-lead, .hs .hs-text { margin-bottom: 12px; }
  .hs .hs-stat { margin-bottom: 12px; }
}

/* Reduced motion: no autoplay video (posters), no slide movement, rotation only by the user */
@media (prefers-reduced-motion: reduce) {
  .hs-wrap { --hs-fade: .01s; }
  .hs-slide, .hs-slide.is-active { transform: none; transition: opacity .2s ease, visibility 0s; }
}
