/* 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%; }
