/*
 * WordPress layer on top of style.css (the approved HTML design, unchanged).
 *
 * Only what the static markup did not need: image logos, core list blocks
 * inside cards, automatic numbering, text pages, the Bitrix24 form window.
 */

/* --- Accessibility ------------------------------------------------------ */

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 12px;
}

/* --- Logo (image instead of the text mark) ------------------------------ */

.logo__img {
  display: block;
  height: 40px;
  width: auto;
}

/* --- Latest cases: «Все кейсы» under the grid --------------------------- */

.latest-cases__all {
  margin-top: 32px;
}

/* --- Header drop-downs (second menu level) ------------------------------ */

.nav__list > .menu-item-has-children {
  position: relative;
}

/* Chevron after a parent item; the underline (::after) stays as it was. */
.nav__list > .menu-item-has-children > .nav__link {
  padding-right: 18px;
}

.nav__list > .menu-item-has-children > .nav__link::before {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -6px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.25s var(--ease);
}

.nav__list > .menu-item-has-children:hover > .nav__link::before,
.nav__list > .menu-item-has-children:focus-within > .nav__link::before {
  transform: rotate(180deg);
}

.nav .sub-menu {
  position: absolute;
  top: 100%;
  left: -18px;
  z-index: 130;
  min-width: 260px;
  margin-top: 12px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-card);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}

/* Bridge over the gap so the pointer can travel from the item to the list. */
.nav .sub-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

.nav__list > li:hover > .sub-menu,
.nav__list > li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.nav .sub-menu .nav__link {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  font-size: 15px;
  white-space: nowrap;
}

.nav .sub-menu .nav__link::after {
  display: none;
}

.nav .sub-menu .nav__link:hover,
.nav .sub-menu .nav__link.is-active {
  background: var(--accent-soft);
}

/* Mobile menu: children listed under their parent, smaller and indented. */
.mobile-menu {
  overflow-y: auto;
}

.mobile-menu .sub-menu {
  padding: 4px 0 8px 16px;
  border-bottom: 1px solid var(--line-dark);
}

.mobile-menu .sub-menu .mobile-menu__link {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--on-dark-muted);
  padding: 8px 0;
  border-bottom: 0;
}

.mobile-menu__list > .menu-item-has-children > .mobile-menu__link {
  border-bottom: 0;
}

/* --- Hero: the accreditation chip sits above the document cards --------- */

.hero__chip {
  z-index: 3;
  top: -30px; /* rests on the card's edge instead of covering its title */
}

/* --- Sections ----------------------------------------------------------- */

/* Blocks stacked inside one section: grid → video, reviews → Telegram… */
.section__body > * + * {
  margin-top: clamp(40px, 5vw, 64px);
}

.section__body > .banner + .banner {
  margin-top: 24px;
}

.section--compact-top {
  padding-top: clamp(40px, 5vw, 64px);
}

.split__lead {
  margin-bottom: 32px;
}

.features__grid--single {
  grid-template-columns: 1fr;
}

.feature-card--light .feature-card__title {
  color: var(--ink);
}

/* --- Automatic numbering: reorder cards, numbers follow ----------------- */

.services__grid {
  counter-reset: hrg-service;
}

.service-card {
  counter-increment: hrg-service;
}

.service-card__num:empty::before {
  content: counter(hrg-service, decimal-leading-zero);
}

.steps {
  counter-reset: hrg-step;
}

.step-card {
  counter-increment: hrg-step;
}

.step-card__num:empty::before {
  content: counter(hrg-step);
}

/* --- Page hero: card with a list of facts ------------------------------- */

.page-hero__grid--center {
  align-items: center;
}

.page-hero__card-points {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line-dark);
}

.page-hero__card-points li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15px;
  color: var(--on-dark);
}

.page-hero__card-points svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  color: var(--accent-light);
}

/* --- Numbered points (О компании: «Почему долгосрочные отношения…») ------ */

.points__grid {
  counter-reset: hrg-point;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.point-card {
  counter-increment: hrg-point;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 30px 28px;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

.point-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card);
  border-color: rgba(116, 86, 241, 0.4);
}

.point-card__num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--accent);
  margin-bottom: 28px;
}

.point-card__num:empty::before {
  content: counter(hrg-point, decimal-leading-zero);
}

.point-card__title {
  font-size: 1.08rem;
  margin-bottom: 12px;
}

.point-card__text {
  font-size: 15px;
  color: var(--muted);
}

.section--dark .point-card {
  background: var(--ink-2);
  border-color: var(--line-dark);
}

.section--dark .point-card__text {
  color: var(--on-dark-muted);
}

.section--dark .point-card__num {
  -webkit-text-stroke-color: var(--accent-light);
}

/* --- Bar chart (О компании: сколько лет клиенты с нами) ------------------ */

/* Heading and note on the left, bars on the right. */
.lifecycle {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  grid-template-areas: "head rows" "note rows";
  grid-template-rows: auto 1fr;
  gap: 0 clamp(32px, 5vw, 72px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: clamp(28px, 4vw, 48px);
}

.lifecycle__head {
  grid-area: head;
}

.lifecycle__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.lifecycle .lifecycle__title {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  line-height: 1.25;
  color: var(--ink);
}

.lifecycle__rows {
  grid-area: rows;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.lifecycle__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 16px;
  align-items: baseline;
}

.lifecycle__row-label {
  font-weight: 600;
  color: var(--ink);
}

.lifecycle__value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.lifecycle__track {
  grid-column: 1 / -1;
  height: 12px;
  border-radius: 999px;
  background: var(--lavender);
  overflow: hidden;
}

.lifecycle__bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  transition: width 1.2s var(--ease) var(--delay, 0ms);
}

.lifecycle.is-visible .lifecycle__bar {
  width: var(--value);
}

.lifecycle__note {
  grid-area: note;
  align-self: end;
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}

.section--dark .lifecycle {
  background: var(--ink-2);
  border-color: var(--line-dark);
}

.section--dark .lifecycle .lifecycle__title,
.section--dark .lifecycle__row-label {
  color: #fff;
}

.section--dark .lifecycle__label,
.section--dark .lifecycle__value {
  color: var(--accent-light);
}

.section--dark .lifecycle__track {
  background: rgba(255, 255, 255, 0.08);
}

.section--dark .lifecycle__note {
  color: var(--on-dark-muted);
}

@media (max-width: 920px) {
  .lifecycle {
    grid-template-columns: 1fr;
    grid-template-areas: "head" "rows" "note";
    grid-template-rows: auto;
  }
  .lifecycle__head {
    margin-bottom: 28px;
  }
}

/* 3, 6 or 9 points read better as rows of three. */
@media (min-width: 1081px) {
  .points__grid:has(> :nth-child(3):last-child),
  .points__grid:has(> :nth-child(6):last-child),
  .points__grid:has(> :nth-child(9):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .features__grid:not(.features__grid--single):has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .points__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .points__grid {
    grid-template-columns: 1fr;
  }
}

/* --- Contacts page: cards + map ----------------------------------------- */

.contacts__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.contacts__inner--no-map {
  grid-template-columns: 1fr;
}

.contacts__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.contacts__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 24px;
}

.contacts__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 18px;
}

.contacts__icon svg {
  width: 20px;
  height: 20px;
}

.contacts__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.contacts__value {
  font-weight: 700;
  font-size: 16.5px;
  color: var(--ink);
}

a.contacts__value:hover {
  color: var(--accent);
}

.contacts__sep {
  margin: 0 8px;
  color: var(--muted);
}

.contacts__map {
  position: relative;
  min-height: 420px;
  border-radius: var(--radius-l);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--lavender);
}

.contacts__map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 920px) {
  .contacts__inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .contacts__grid {
    grid-template-columns: 1fr;
  }
  .contacts__map {
    min-height: 320px;
  }
}

/* --- Core list blocks styled as the design's lists ----------------------- */

.step-card__body ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-card__body li {
  position: relative;
  padding-left: 20px;
  font-size: 14.5px;
  color: var(--muted);
}

.step-card__body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.price-card__title {
  font-size: 1.15rem;
  margin-bottom: 20px;
}

.price-card__list {
  margin-bottom: 28px;
}

.price-card__list ul {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.price-card__list li {
  position: relative;
  padding-left: 36px;
  font-size: 16px;
}

.price-card__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 22px;
  height: 22px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.faq__a-content ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  padding-left: 20px;
  list-style: disc;
}

/* Team of 9 or 6: a 3-column grid instead of 4 + 4 + 1. */
@media (min-width: 1081px) {
  .team__grid:has(> :nth-child(9):last-child),
  .team__grid:has(> :nth-child(6):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- Photos chosen in the editor ---------------------------------------- */

.director__photo > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.client-logo--image {
  min-height: 104px;
}

/* Width is set per logo in render.php (optical sizing). */
.client-logo--image img {
  max-width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.15);
  opacity: 0.8;
  transition: filter 0.25s var(--ease), opacity 0.25s var(--ease);
}

.client-logo--image:hover img {
  filter: none;
  opacity: 1;
}

/* --- Video: player swapped in on click ---------------------------------- */

/* Poster frame under the play button, dimmed so the caption stays legible. */
.video__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video--poster::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(0deg, rgba(23, 18, 33, 0.85) 0%, rgba(23, 18, 33, 0) 45%),
    rgba(23, 18, 33, 0.25);
}

/* With a poster the caption moves to the bottom-left corner, off the frame's own text. */
.video--poster .video__inner {
  position: static;
  z-index: 1;
}

.video--poster .video__play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  margin: -42px 0 0 -42px;
  box-shadow: 0 12px 40px rgba(116, 86, 241, 0.45);
}

.video--poster .video__caption,
.video--poster .video__sub {
  position: absolute;
  left: clamp(20px, 4vw, 48px);
  right: clamp(20px, 4vw, 48px);
  z-index: 1;
  text-align: left;
}

.video--poster .video__caption {
  bottom: clamp(48px, 6vw, 76px);
}

.video--poster .video__sub {
  bottom: clamp(20px, 3vw, 40px);
}

/* Phones: the 16:7.5 frame is ~160px tall — too short for button + two captions over the
   poster's own text. Full 16:9, a smaller button, the title only, a darker poster. */
@media (max-width: 640px) {
  .video--poster {
    aspect-ratio: 16 / 9;
  }

  .video--poster::before {
    background:
      linear-gradient(0deg, rgba(23, 18, 33, 0.92) 0%, rgba(23, 18, 33, 0) 55%),
      rgba(23, 18, 33, 0.55);
  }

  .video--poster .video__play {
    width: 56px;
    height: 56px;
    margin: -40px 0 0 -28px;
  }

  .video--poster .video__play svg {
    width: 20px;
    height: 20px;
  }

  .video--poster .video__caption {
    bottom: 16px;
    font-size: 15px;
  }

  .video--poster .video__sub {
    display: none;
  }
}

/* While playing, the frame takes the film's own 16:9. */
.video.is-playing {
  aspect-ratio: 16 / 9;
}

.video video,
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 2;
  background: #000;
}

/* --- Footer -------------------------------------------------------------- */

.footer__bottom-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}

/* --- Request window: Bitrix24 form -------------------------------------- */

.modal__form {
  min-height: 40px;
}

.modal__notice {
  padding: 14px 16px;
  border-radius: var(--radius-s);
  background: var(--lavender);
  font-size: 14.5px;
}

.modal__notice a {
  color: var(--accent);
  text-decoration: underline;
}

/* --- Text pages (policy, terms, posts) ---------------------------------- */

.text-page__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 32px;
}

.text-page__content {
  max-width: 760px;
}

.text-page__content > * + * {
  margin-top: 1em;
}

.text-page__content h2,
.text-page__content h3 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.25;
  margin-top: 1.8em;
}

.text-page__content ul,
.text-page__content ol {
  padding-left: 1.3em;
}

.text-page__content ul {
  list-style: disc;
}

.text-page__content ol {
  list-style: decimal;
}

.text-page__content a {
  color: var(--accent);
  text-decoration: underline;
}

.text-page--center {
  text-align: center;
}

.text-page--center .cta__actions {
  justify-content: center;
  margin-top: 32px;
}

/* --- Quiz «Получить расчёт» (inc/quiz.php) ------------------------------ */

.quiz {
  width: min(560px, 100%);
}

.quiz__progress {
  height: 6px;
  border-radius: 3px;
  background: var(--lavender);
  overflow: hidden;
  margin: 18px 0 8px;
}

.quiz__bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.35s var(--ease);
}

.quiz__counter {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 22px;
}

.quiz__step {
  display: none;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.quiz__step.is-active {
  display: block;
  animation: quiz-in 0.3s var(--ease);
}

@keyframes quiz-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

.quiz__question {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}

.quiz__options {
  display: grid;
  gap: 10px;
}

.quiz__option {
  position: relative;
  display: block;
  cursor: pointer;
}

.quiz__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quiz__option span {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--bg);
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s;
}

.quiz__option span::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 50%;
  transition: border 0.2s;
}

.quiz__option:hover span {
  border-color: rgba(116, 86, 241, 0.45);
}

.quiz__option input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.quiz__option input:checked + span::before {
  border: 5px solid var(--accent);
}

.quiz__option input:focus-visible + span {
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.quiz__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
}

.quiz__error {
  margin: -8px 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: #c62f3d;
}

.quiz__back {
  margin-top: 18px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.quiz__back:hover {
  color: var(--accent);
}

.modal--quiz.is-done .quiz__progress,
.modal--quiz.is-done .quiz__counter {
  display: none;
}

@media (max-width: 640px) {
  .modal--quiz .modal__dialog {
    padding: 32px 22px;
  }
}

/* --- Service card with a photo (own, or the linked page's featured image) --- */

.service-card__media {
  margin: -34px -30px 24px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-m) var(--radius-m) 0 0;
  background: var(--lavender);
}

.service-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.service-card--image:hover .service-card__media img {
  transform: scale(1.05);
}

/* The icon badge sits on the photo's corner instead of beside the number. */
.service-card--image .service-card__icon {
  top: 16px;
  right: 16px;
  z-index: 1;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(23, 18, 33, 0.18);
}
