/* WordPress additions on top of the source CSS: consent checkbox, form error, cookie banner,
   legal documents, article content from the editor. Colours and fonts — source tokens only. */

:root {
  --st-space-1: 0.25rem;
  --st-space-2: 0.5rem;
  --st-space-3: 0.75rem;
  --st-space-4: 1rem;
  --st-space-5: 1.5rem;
  --st-space-6: 2rem;
  --st-space-7: 3rem;
  --st-radius: 0.75rem;
  --st-paper: #ffffff;          /* the Yandex badge background, as in the source picture */
  --st-star: #ffd25f;           /* Yandex rating star */
}

/* ---------- lead form: consent + server error ---------- */
.form .check {
  display: grid;
  grid-template-columns: 1.125rem minmax(0, 1fr);
  gap: var(--st-space-3);
  align-items: start;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--color-grey-dark);
  cursor: pointer;
}
.form .check input {
  appearance: none;
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.0625rem 0 0;
  border: 1px solid var(--color-grey);
  border-radius: 0.25rem;
  background: var(--color-white);
  position: relative;
  cursor: pointer;
}
.form .check input:checked { background: var(--color-accent); border-color: var(--color-accent); }
.form .check input:checked::after {
  content: '';
  position: absolute;
  left: 0.3125rem;
  top: 0.0625rem;
  width: 0.3125rem;
  height: 0.625rem;
  border: solid var(--color-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.form .check input:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.form .check input[aria-invalid="true"] { border-color: var(--color-accent); }
.form .check a { color: var(--color-accent); text-decoration: underline; }
.form__error { color: var(--color-accent); font-size: 0.875rem; line-height: 1.4; }
.form [hidden], .form .st-hp { display: none !important; }

/* ---------- cookie banner ---------- */
.cookie {
  position: fixed;
  left: var(--st-space-4);
  right: var(--st-space-4);
  bottom: var(--st-space-4);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--st-space-5);
  max-width: 58.75rem;
  margin-inline: auto;
  padding: var(--st-space-4) var(--st-space-5);
  border-radius: var(--st-radius);
  background: var(--color-black);
  color: var(--color-white);
  box-shadow: 0 1rem 2.75rem rgba(0, 0, 0, 0.35);
  font-family: var(--font-main);
}
.cookie[hidden] { display: none !important; }
.cookie__text { flex: 1 1 auto; font-size: 0.875rem; line-height: 1.5; color: var(--color-grey); }
.cookie__text a { color: var(--color-white); text-decoration: underline; }
.cookie__actions { display: flex; gap: var(--st-space-2); flex: none; }
.cookie__actions .button { white-space: nowrap; }
.cookie__btn-ghost { background: transparent; color: var(--color-white); border: 1px solid var(--color-grey-light); }
.cookie--out { opacity: 0; transform: translateY(0.75rem); transition: opacity 0.24s, transform 0.24s; }
@media (max-width: 768px) {
  .cookie { flex-direction: column; align-items: stretch; gap: var(--st-space-3); left: var(--st-space-2); right: var(--st-space-2); bottom: var(--st-space-2); }
  .cookie__actions .button { flex: 1 1 0; }
}
@media (max-width: 480px) {
  .cookie__actions { flex-direction: column; }
  .cookie__actions .button { flex: none; width: 100%; white-space: normal; }
}

/* ---------- legal documents ---------- */
.doc { padding-block: var(--st-space-7); color: var(--color-text); font-family: var(--font-main); }
/* the document takes the site container; running text keeps a readable line, tables use the full width */
.doc p, .doc ul, .doc ol, .doc h1, .doc h2 { max-width: 62rem; }
.doc h1 { display: block; font-size: 2rem; line-height: 1.15; font-weight: 600; margin: var(--st-space-5) 0 var(--st-space-3); color: var(--color-black); }
.doc h2 { display: block; font-size: 1.25rem; font-weight: 600; margin: var(--st-space-6) 0 var(--st-space-3); color: var(--color-black); }
.doc p, .doc li { display: block; margin: 0 0 var(--st-space-3); line-height: 1.6; }
.doc ul, .doc ol { margin: 0 0 var(--st-space-4); padding-left: var(--st-space-5); }
.doc ul li { display: list-item; list-style: disc; }
.doc ol li { display: list-item; list-style: decimal; }
.doc strong, .doc b { font-weight: 600; }
.doc a { color: var(--color-accent); text-decoration: underline; }
.doc__back { display: inline-flex; align-items: center; gap: var(--st-space-2); text-decoration: none !important; color: var(--color-grey-dark) !important; }
.doc__back svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 2; }
.doc__date { color: var(--color-grey-light); }
.doc__wide { margin: var(--st-space-4) 0 var(--st-space-5); }
.doc__table { width: 100%; border-collapse: collapse; font-size: var(--text-size-base); line-height: 1.5; }
.doc__table th, .doc__table td { display: table-cell; padding: var(--st-space-3) var(--st-space-4); border: 1px solid var(--color-grey); text-align: left; vertical-align: top; }
.doc__table th { font-weight: 600; background: var(--color-white); color: var(--color-black); }
/* phone: every row becomes a card, the column name sits above each value */
@media (max-width: 640px) {
  .doc__table, .doc__table tbody, .doc__table tr, .doc__table td { display: block; width: 100%; }
  .doc__table thead { display: none; }
  .doc__table tr { margin-bottom: var(--st-space-3); border: 1px solid var(--color-grey); border-radius: var(--st-radius); overflow: hidden; background: var(--color-white); }
  .doc__table td { border: 0; border-top: 1px solid var(--color-grey); padding: var(--st-space-2) var(--st-space-3); }
  .doc__table td:first-child { border-top: 0; font-weight: 600; color: var(--color-black); }
  .doc__table td::before { content: attr(data-label); display: block; margin-bottom: var(--st-space-1); font-size: 0.75em; font-weight: 400; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-grey-light); }
}

/* ---------- video popup: the layout let the shrink-to-fit popup take the video's own size (300px before
   metadata) and rounded the <video> by 42px, cutting the player controls in the corners.
   Both players get an explicit size: as tall as the screen allows at the clip's ratio, never wider than the screen.
   --st-video-ar is set by index.js from the file's metadata; VK clips of the works are vertical, 9:16 ---------- */
.popup-video .popup__content { width: 100%; }
/* phones: a vertical clip is limited by the width, so the side fields of the popup shrink to a thin edge */
@media screen and (max-width: 640px) { .popup-video .popup__wrapper { padding: 0 var(--st-space-2); } }
.popup-video .modal-video { height: 100vh; height: 100dvh; padding: 2.5vh 0; padding: 2.5dvh 0; }
.modal-video__wrapper video,
.modal-video__wrapper iframe {
  display: block;
  width: min(100%, 95vh * var(--st-video-ar, 0.5625));
  width: min(100%, 95dvh * var(--st-video-ar, 0.5625));
  height: auto;
  max-height: 100%;
  aspect-ratio: var(--st-video-ar, 0.5625);
  object-fit: contain;
  border: 0;
  border-radius: var(--st-radius);
  background: var(--color-black);
}
.modal-video__wrapper iframe[hidden], .modal-video__wrapper video[hidden] { display: none; }

/* ---------- close button of the video and photo popups (the layout has none) ---------- */
.st-popup-x {
  position: fixed;
  top: max(var(--st-space-4), env(safe-area-inset-top, 0px));
  right: var(--st-space-4);
  z-index: 5;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-white);
  cursor: pointer;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
  transition: background-color 0.3s;
}
.st-popup-x::before, .st-popup-x::after {
  content: '';
  position: absolute;
  left: 30%;
  top: calc(50% - 1px);
  width: 40%;
  height: 2px;
  background: var(--color-black);
  transform: rotate(45deg);
  transition: background-color 0.3s;
}
.st-popup-x::after { transform: rotate(-45deg); }
.st-popup-x:hover { background: var(--color-accent); }
.st-popup-x:hover::before, .st-popup-x:hover::after { background: var(--color-white); }
.st-popup-x:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (max-width: 640px) { .st-popup-x { width: 2.25rem; height: 2.25rem; right: var(--st-space-3); } }

/* ---------- article content from the editor ---------- */
.st-content { color: var(--color-text); }
.st-content > * + * { margin-top: var(--st-space-4); }
.st-content p, .st-content li { line-height: 1.6; }
.st-content h2, .st-content h3, .st-content h4 { display: block; font-weight: 600; line-height: 1.25; color: var(--color-black); margin-top: var(--st-space-6); }
.st-content h2 { font-size: 1.5rem; }
.st-content h3 { font-size: 1.25rem; }
.st-content h4 { font-size: 1.125rem; }
.st-content b, .st-content strong { font-weight: 600; }
.st-content em, .st-content i { font-style: italic; }
.st-content a { color: var(--color-accent); text-decoration: underline; }
.st-content ul, .st-content ol { padding-left: var(--st-space-5); }
.st-content ul > li { display: list-item; list-style: disc; }
.st-content ol > li { display: list-item; list-style: decimal; }
/* the design draws dots and numbers in .page-block li::before with a counter; the block editor splits a list into
   <ol start="2">…, where that counter starts over — so articles keep the native markers (they honour start), in the accent */
.st-content :is(ol, ul) > li::before { content: none; }
.st-content li::marker { color: var(--color-accent); }
.st-content ol > li::marker { font-weight: 600; }
.st-content li + li { margin-top: var(--st-space-2); }
.st-content img { display: block; height: auto; max-width: 100%; max-height: 80vh; width: auto; margin-inline: auto; border-radius: var(--st-radius); }
.st-content figure { display: block; }
.st-content figcaption { display: block; margin-top: var(--st-space-2); font-size: 0.875rem; color: var(--color-grey-light); text-align: center; }
.st-content table { display: table; width: 100%; border-collapse: collapse; }
.st-content td, .st-content th { display: table-cell; padding: var(--st-space-2); border: 1px solid var(--color-grey); }
.st-content blockquote { display: block; padding-left: var(--st-space-4); border-left: 3px solid var(--color-accent); }
.st-content iframe, .st-content video { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: var(--st-radius); }
.st-content .wp-block-image, .st-content .wp-caption { width: auto !important; }
/* «Галерея» block: photos in a row as in the design — 2 split the row, up to 3 per row, a short last row stretches,
   2 per row on phones; a cropped gallery shows squares. The single-image rules above (figure block, width auto, 80vh) stacked them */
.st-content .wp-block-gallery { display: flex; flex-wrap: wrap; gap: var(--st-space-4); }
.st-content .wp-block-gallery > .wp-block-image { display: flex; flex-direction: column; flex: 1 1 calc((100% - 2 * var(--st-space-4)) / 3); min-width: 0; margin: 0; }
.st-content .wp-block-gallery.columns-2 > .wp-block-image { flex-basis: calc((100% - var(--st-space-4)) / 2); }
.st-content .wp-block-gallery.columns-1 > .wp-block-image { flex-basis: 100%; }
/* core sizes a cropped photo by the row (flex: 1 0 0%, height: 100%, behind :not(#individual-image)); with the caption under it
   that squeezes the photo to nothing — the height comes from the ratio instead, figures stay as tall as their content */
.st-content .wp-block-gallery { align-items: flex-start; }
/* core stretches every cell to the tallest one (align-self: inherit) and centres the photo in it (justify-content: center):
   next to a captioned photo the other dropped by half the caption — photos sit at the top of the row */
.st-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) { align-self: flex-start; justify-content: flex-start; }
.st-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) img,
.st-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) img { flex: none; width: 100%; height: auto; max-height: none; margin: 0; object-fit: cover; }
/* a photo with a link sits in <a>, which core sizes the same way, and the caption grows — both take their own height */
.st-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) > a,
.st-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(#individual-image) > a,
.st-content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) > figcaption { flex: none; width: 100%; height: auto; margin-inline: 0; }
.st-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image:not(:only-child):not(#individual-image) img { aspect-ratio: 1; }
/* a caption goes under the photo, as for a single image — core lays it over the photo in white on a blur */
.st-content .wp-block-gallery.has-nested-images figure.wp-block-image figcaption { position: static; max-height: none; overflow: visible; padding: 0;
  margin-top: var(--st-space-2); background: none; color: var(--color-grey-light); text-shadow: none; font-size: 0.875rem; }
.st-content .wp-block-gallery.has-nested-images figure.wp-block-image:has(figcaption)::before { content: none; }
@media (max-width: 480px) {
  .st-content .wp-block-gallery { gap: var(--st-space-3); }
  .st-content .wp-block-gallery > .wp-block-image { flex-basis: calc((100% - var(--st-space-3)) / 2); }
  .st-content .wp-block-gallery.columns-1 > .wp-block-image { flex-basis: 100%; }
}

/* ---------- popups: a tap on the empty area closes them on iPhone too.
   iOS Safari sends a tap to the document click handler only from elements that look clickable ---------- */
.popup__overlay { cursor: pointer; }

/* ---------- Yandex button: rating as text from «Настройки сайта» + logo.
   Positions repeat the old picture yd.webp (158x50): rating box 9–58 x 8–40, logo from x 62 ---------- */
/* cqh counts from the content box: header buttons carry their own padding, the badge content is absolute anyway */
.button-yd, .header-buttons__item.button-yd { container-type: size; padding: 0; background: var(--st-paper); }
.button-yd__rating {
  position: absolute;
  left: 5.7%;
  top: 16%;
  width: 31.6%;
  height: 66%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6cqh;
  border: 1px solid color-mix(in srgb, var(--color-grey) 55%, transparent);
  border-radius: 15cqh;
  font-family: var(--font-main);
  font-size: 32cqh;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  color: var(--color-black);
}
.button-yd__star { width: 26cqh; height: 26cqh; fill: var(--st-star); flex: none; }
.button-yd__logo { position: absolute; left: 39.2%; top: 0; width: 60.8%; height: 100%; object-fit: contain; }
.button-yd:not(:has(.button-yd__rating)) .button-yd__logo { left: 19.6%; }

/* ---------- «О нас»: founder photo in the dark card (Figma 2026-11, node 4656-4016).
   Sidebar card (≥1241): rounded square right of kicker+title; full-width card: circle on the right;
   phone: circle between kicker and title. Field «Фото в карточке» in block «О нас» ---------- */
.page-card__header--photo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "kicker photo" "title photo";
  align-items: start;
  column-gap: 1.875rem;
}
.page-card__header--photo .page-card__kicker { grid-area: kicker; }
.page-card__header--photo .page-card__title { grid-area: title; }
.page-card__photo {
  grid-area: photo;
  width: 8.75rem;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--color-grey);
}
.page-card__photo .image__item { object-position: 50% 0; }
/* sidebar card, Figma «О нас» 2026-11-13: photo ~30% of the card, title one step smaller so «Иванов Евгений,»
   fits beside it, card as tall as its content (the design's 90vh card pushed the intro to the bottom) */
@media screen and (min-width: 1241px) {
  .page-card__header--photo { column-gap: 3rem; row-gap: 1.5rem; }
  /* upright portrait, Figma 2026-11-13: about 6:7, head and shoulders from the top of the photo */
  .page-card__photo { width: 12.25rem; aspect-ratio: 233 / 270; border-radius: 1.25rem; }
  .page-card__header--photo .page-card__title { font-size: 2.15rem; }
  .page-card__header--photo .page-card__title br { display: none; }
  .page-card:has(.page-card__header--photo) .page-card__wrapper { min-height: auto; justify-content: flex-start; }
  .page-card:has(.page-card__header--photo) .page-card__text { font-size: 1.25rem; }
}
@media screen and (max-width: 640px) {
  .page-card__header--photo { grid-template-columns: minmax(0, 1fr); grid-template-areas: "kicker" "photo" "title"; }
  .page-card__photo { width: 5.5rem; }
}

/* ---------- works grid: photos and video files in one lightbox, arrows/swipes go through both.
   The lightbox is click-through (pointer-events: none) so a click beside the media hits the overlay and closes it ---------- */
.lightbox-popup__video {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: var(--st-radius);
  background: var(--color-black);
  pointer-events: auto;
}
.lightbox-popup__video[hidden], .lightbox-popup__img[hidden] { display: none; }
@media screen and (max-width: 640px) { .lightbox-popup__video { order: 1; height: auto; width: 100%; max-height: calc(100% - 3.5rem); } }

/* ---------- video popup: the player box filled the whole screen and swallowed the click on the empty area.
   Only the player takes clicks now, the rest falls through to the overlay, which closes the popup ---------- */
.popup-video .popup__content,
.popup-video .modal-video,
.popup-video .modal-video__wrapper { pointer-events: none; }
.popup-video .modal-video__wrapper video,
.popup-video .modal-video__wrapper iframe { pointer-events: auto; }

/* ---------- articles: Easy FancyBox marks image links «fancybox image» at runtime; the design's .image
   (flex, 100% wide, centred) turned every inline link in the text into its own centred line ---------- */
.st-content a.image:not(:has(img)) {
  display: inline;
  width: auto;
  height: auto;
  overflow: visible;
  user-select: auto;
  -webkit-user-select: auto;
  -webkit-touch-callout: default;
}
/* old posts glue words with &nbsp; chains («У дизайнерских или секционных»); on a phone such a chain is wider
   than the line and pushed the page sideways. Break it only when it does not fit */
.st-content { overflow-wrap: break-word; }
