@media (max-width: 768px) {
  main > :is(.categories-section, .cities-section, .standards-section, .seo-text-section,
    .faq-section, .city-method, .city-nearby, .city-editorial, .city-faq,
    .rating-method, .category-faq),
  main > #about-city-platform {
    padding-block: 56px;
  }

  main > .category-city-grid-section {
    padding-block: 0 56px;
  }

  main > section:not(.hero-section, .grow-business-section) :is(h2.display.h-md, .category-section-head h2,
    .city-section-head h2, .city-nearby h2, .faq-layout h2, .city-faq h2) {
    font-size: clamp(27px, 6vw, 36px);
    line-height: 1.12;
    text-wrap: balance;
  }

  /* --- Mobile headings: let the accent flow after the lead words (no forced break, no empty right side) --- */
  main > section:not(.hero-section, .grow-business-section) h2 br:has(+ .section-em) {
    display: none;
  }

  main > section:not(.hero-section, .grow-business-section) h2 br + .section-em::before {
    content: " ";
  }

  /* --- Direction pages on phones --- */

  /* «Найдено компаний» stays for screen readers (aria-live) but takes no space. */
  main .ranking-toolbar:has(> #resultCount:only-child) {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
    white-space: nowrap;
  }

  main .ranking-ad-banner__meta {
    display: none;
  }

  /* The rating right after the direction hero: same rhythm as other sections. */
  main > .category-hero + .ranking-section {
    padding-block: 48px 56px;
  }

  /* Light separator between the rating (after pagination) and the city grid; both are white. */
  main .ranking-section + .category-city-grid-section > .container {
    padding-top: 48px;
    border-top: 1px solid #ececef;
  }

  /* Breadcrumbs wrap between items, never inside one. */
  main :is(.category-breadcrumbs, .city-hero-breadcrumbs) {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  main :is(.category-breadcrumbs, .city-hero-breadcrumbs) > * {
    white-space: nowrap;
  }

  /* City direction hero: H1 sits on the sky of a compact banner, the lead goes under it. */
  body.category-layout-v2 .ranking-section .ranking-breadcrumbs {
    margin-bottom: 16px;
    font-size: 13px;
  }

  /* The frame is 3.41:1 and the people start at 64% of its width. With the picture pinned right,
     they begin 1.23 × banner height from the right edge; the heading keeps to the sky left of that. */
  body.category-layout-v2 .ranking-ad-banner {
    --banner-h: clamp(120px, 35vw, 220px);
    display: grid;
    margin: 0;
    overflow: visible;
  }

  body.category-layout-v2 .ranking-ad-banner > img {
    grid-area: 1 / 1;
    width: 100%;
    height: var(--banner-h);
    border-radius: 12px;
    object-fit: cover;
    object-position: 100% 50%;
    filter: none;
  }

  body.category-layout-v2 .ranking-ad-banner__content {
    display: contents;
  }

  body.category-layout-v2 .ranking-ad-banner h1 {
    z-index: 1;
    grid-area: 1 / 1;
    align-self: center;
    max-width: calc(100% - var(--banner-h) * 1.23 - 8px);
    margin: 0;
    padding: 12px 0 12px 16px;
    color: #fff;
    font-size: clamp(16px, 4.6vw, 24px);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -.015em;
    text-wrap: balance;
  }

  /* Narrow phones: not enough sky for the heading, so it goes under the picture. */
  @media (max-width: 359px) {
    body.category-layout-v2 .ranking-ad-banner h1 {
      grid-area: 2 / 1;
      max-width: none;
      padding: 14px 0 0;
      color: var(--color-title);
      font-size: 22px;
    }

    body.category-layout-v2 .ranking-ad-banner .ranking-ad-banner__lead {
      grid-row: 3;
    }
  }

  body.category-layout-v2 .ranking-ad-banner__lead {
    grid-row: 2;
    max-width: none;
    margin-top: 12px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 400;
    line-height: 17px;
  }

  /* Filter bar: one button for the sheet and quick chips for every subcategory. */
  .mobile-filterbar:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px -16px 16px 0;
  }

  main .ranking-split__main > .ranking-results {
    margin-top: 0;
  }

  .mobile-filterbar__open {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #e2e2e6;
    border-radius: 999px;
    background: #fff;
    color: var(--color-title);
    font: 500 14px/1 var(--font-body);
    cursor: pointer;
  }

  .mobile-filterbar__count:not([hidden]) {
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
  }

  .mobile-filterbar__chips {
    display: flex;
    flex: 1 1 auto;
    gap: 8px;
    min-width: 0;
    padding-right: 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }

  .mobile-filterbar__chips::-webkit-scrollbar {
    display: none;
  }

  .mobile-filterbar__chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: #f1f1f3;
    color: var(--color-title);
    font: 400 14px/1 var(--font-body);
    white-space: nowrap;
    cursor: pointer;
  }

  .mobile-filterbar__chip[aria-pressed="true"] {
    background: var(--color-title);
    color: #fff;
  }

  :is(.mobile-filterbar__open, .mobile-filterbar__chip, .filter-sheet__close, .filter-sheet__foot button):focus-visible {
    outline: 2px solid var(--color-title);
    outline-offset: 2px;
  }

  /* Filter sheet: the existing sidebar becomes a full-screen panel on phones. */
  main .ranking-split {
    display: block;
  }

  main .ranking-split > .ranking-sidebar {
    display: none;
  }

  main .ranking-split > .ranking-sidebar.is-open {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    background: #fff;
  }

  .filter-sheet__head:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    min-height: 64px;
    padding: 10px 16px;
    border-bottom: 1px solid #eeeef1;
  }

  .filter-sheet__title {
    margin: 0;
    color: var(--color-title);
    font: 500 20px/1.2 var(--font-title);
  }

  .filter-sheet__close {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f1f3;
    color: var(--color-title);
    cursor: pointer;
  }

  main .ranking-sidebar.is-open .ranking-filters {
    position: static;
    flex: 1 1 auto;
    min-height: 0;
    padding: 8px 16px 16px;
    overflow-y: auto;
    border: 0;
  }

  main .ranking-split > .ranking-sidebar .ranking-filters fieldset {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  main .ranking-sidebar .ranking-filters legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  main .ranking-split > .ranking-sidebar .ranking-filters fieldset label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    gap: 16px;
    min-height: 52px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f2;
    color: var(--color-title);
    font-size: 16px;
    line-height: 1.35;
  }

  main .ranking-sidebar .ranking-filters input[type="checkbox"] {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin: 0;
    border-radius: 6px;
  }

  main .ranking-sidebar .ranking-filters .filters-reset {
    display: none;
  }

  .filter-sheet__foot:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    flex: 0 0 auto;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #eeeef1;
  }

  .filter-sheet__foot button {
    min-height: 52px;
    padding: 0 12px;
    border-radius: 14px;
    font: 600 16px/1.2 var(--font-body);
    cursor: pointer;
  }

  .filter-sheet__reset {
    border: 1px solid #e2e2e6;
    background: #fff;
    color: var(--color-title);
  }

  .filter-sheet__apply {
    border: 0;
    background: var(--color-primary);
    color: #fff;
  }

  /* --- Section rhythm on phones: the city SEO block had 120 px from the desktop rule --- */
  body.city-page main > #about-city-platform {
    padding-block: 56px;
  }

  main .seo-article > :last-child {
    margin-bottom: 0;
  }

  /* --- SEO text on phones: two blocks, the rest behind «Читать всё» --- */
  main .seo-article.is-collapsible:not(.is-expanded) > [data-seo-more] {
    display: none;
  }

  main .seo-article.is-collapsible:not(.is-expanded) > :nth-child(2) {
    margin-bottom: 0;
  }

  /* The layout grid already adds 24 px above the button. */
  main .seo-layout > .seo-more-toggle {
    justify-self: start;
    margin-top: -16px;
  }

  .seo-more-toggle:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-title);
    font: 500 15px/1.2 var(--font-body);
    text-decoration: underline;
    text-decoration-color: rgba(13, 14, 18, .25);
    text-underline-offset: 4px;
    cursor: pointer;
  }

  .seo-more-toggle svg {
    flex: 0 0 16px;
    transition: transform .2s ease;
  }

  .seo-more-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
  }

  .seo-more-toggle:focus-visible {
    outline: 2px solid var(--color-title);
    outline-offset: 2px;
  }

  /* --- FAQ: «Все вопросы» goes under the questions on every page that has it --- */
  main :is(.city-faq__grid, .category-faq .faq-layout):has(> header > .faq-all-link) {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  main :is(.city-faq__grid, .category-faq .faq-layout) > header:has(> .faq-all-link) {
    display: contents;
  }

  main :is(.city-faq__grid, .category-faq .faq-layout):has(> header > .faq-all-link) > :is(.faq-list, .category-faq__list) {
    order: 1;
    margin-top: 24px;
  }

  main :is(.city-faq__grid, .category-faq .faq-layout) > header > .faq-all-link {
    order: 2;
    display: flex;
    align-self: stretch;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: none;
    min-height: 48px;
    margin: 24px 0 0;
    padding: 0 16px;
    border: 1px solid #e2e2e6;
    border-radius: 14px;
    color: var(--color-title);
    font: 500 15px/1.2 var(--font-body);
    text-decoration: none;
  }

  /* --- City page order on phones: rubricator, business banner, «Как сделать выбор», other cities, the rest --- */
  body.city-page main {
    display: flex;
    flex-direction: column;
  }

  body.city-page main > .city-business-cta {
    order: 1;
  }

  body.city-page main > :is(.city-method, .city-nearby, .city-editorial, .city-faq, .seo-text-section) {
    order: 2;
  }

  /* --- Rubricator: compact tiles (one per row on the city page), the list opens under the tapped tile's row --- */
  main .rubricator-header {
    margin-bottom: 24px;
  }

  main .rubricator-intro {
    max-width: 34em;
    margin-top: 12px;
    color: var(--color-text);
    font-size: 16px;
    line-height: 1.5;
    text-wrap: pretty;
  }

  /* The city rubricator sits on white on phones. */
  main .city-directions.bg-light {
    background: #fff;
  }

  main .rubricator-grid[data-mobile-rubricator] {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: row dense;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
  }

  /* The column itself disappears from layout: its tile and list become grid items. */
  main .rubricator-grid[data-mobile-rubricator] > .rubricator-column {
    display: contents;
  }

  main .rubricator-grid[data-mobile-rubricator] > .rubricator-column::before,
  main .rubricator-grid[data-mobile-rubricator] .rubricator-title {
    display: none;
  }

  /* Name and count on the left, chevron centred on the right. */
  .rubricator-accordion-trigger:not([hidden]) {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    min-width: 0;
    min-height: 0;
    padding: 10px 15px 9px;
    border: 1px solid #e6e6ea;
    border-radius: 12px;
    background: #fff;
    color: var(--color-title);
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .rubricator-accordion-name {
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -.005em;
    overflow-wrap: break-word;
  }

  .rubricator-accordion-meta {
    grid-column: 1;
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.3;
  }

  /* Chevron drawn as a controlled CSS shape inside a fixed 16 px box. */
  .rubricator-accordion-icon {
    position: relative;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    width: 16px;
    height: 16px;
  }

  .rubricator-accordion-icon::before {
    position: absolute;
    top: 3px;
    left: 4px;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: rotate(45deg);
    transition: transform .25s ease, top .25s ease;
  }

  .rubricator-accordion-trigger[aria-expanded="true"] {
    border-bottom-color: transparent;
    border-radius: 12px 12px 0 0;
  }

  .rubricator-accordion-trigger[aria-expanded="true"] .rubricator-accordion-name {
    color: var(--color-primary);
  }

  .rubricator-accordion-trigger[aria-expanded="true"] .rubricator-accordion-icon::before {
    top: 6px;
    transform: rotate(225deg);
  }

  .rubricator-accordion-trigger:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-accordion-body {
    display: none;
  }

  main .rubricator-grid[data-mobile-rubricator] > [data-mobile-open] .rubricator-accordion-body {
    display: block;
    grid-column: 1 / -1;
    margin-top: -6px;
    padding: 0 15px 15px;
    border: 1px solid #e6e6ea;
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: #fff;
    animation: rubricator-panel-in .28s cubic-bezier(.16, 1, .3, 1);
  }

  @keyframes rubricator-panel-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-accordion-inner > * {
    margin: 0;
    padding: 0;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-extra-list[hidden] {
    display: block;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-toggle {
    display: none;
  }

  /* Directions as wrapping pills: 28 items fit in a few rows instead of a long column. */
  main .rubricator-grid[data-mobile-rubricator] .rubricator-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-list li {
    min-width: 0;
    max-width: 100%;
    border: 0;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-list a {
    display: flex;
    align-items: center;
    min-height: 36px;
    margin: 0;
    padding: 7px 12px;
    border-radius: 999px;
    background: #f1f1f3;
    color: var(--color-title);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-list a::after {
    content: none;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-list a:active {
    background: var(--color-primary);
    color: #fff;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-list a:focus-visible {
    padding-left: 12px;
    color: var(--color-title);
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-subtitle {
    margin: 16px 0 8px;
    color: var(--color-text);
    font: 500 13px/1.3 var(--font-body);
    letter-spacing: .02em;
    text-transform: uppercase;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-subgroup:first-child .rubricator-subtitle {
    margin-top: 10px;
  }

  main .rubricator-grid[data-mobile-rubricator] .rubricator-extra-list .rubricator-subgroup:first-child .rubricator-subtitle {
    margin-top: 16px;
  }

  /* Lists without group titles start right under the panel edge. */
  main .rubricator-grid[data-mobile-rubricator] .rubricator-accordion-inner > .rubricator-sections > .rubricator-subgroup:first-child > .rubricator-list:first-child {
    margin-top: 10px;
  }

  /* --- City grids: three tiles per row, photo above the name --- */
  main :is(.cities-section, .category-city-grid-section) .section-header,
  main .category-city-grid-section .category-section-head {
    margin-bottom: 24px;
  }

  main :is(.cities-section, .category-city-grid-section) .cities-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px;
    padding: 0;
    border: 0;
  }

  main :is(.cities-section, .category-city-grid-section) .cities-grid > .city-row:nth-child(n) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    min-height: 0;
    padding: 10px 0 9px;
    border: 1px solid #e6e6ea !important;
    border-radius: 12px;
    background: #fff;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
  }

  main :is(.cities-section, .category-city-grid-section) .city-row > .city-photo {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin: 0;
    border: 0;
    border-radius: 50%;
    object-fit: cover;
    outline: 1px solid rgba(13, 14, 18, .08);
    outline-offset: -1px;
  }

  /* The source frame has a white monument at the right edge that merges with the tile. */
  main .city-row > .city-photo[src$="zhezkazgan.webp"] {
    object-position: 15% 50%;
  }

  main :is(.cities-section, .category-city-grid-section) .city-row > .city-name {
    max-width: 100%;
    color: var(--color-title);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -.02em;
    white-space: normal;
    hyphens: auto;
    overflow-wrap: break-word;
  }

  main :is(.cities-section, .category-city-grid-section) .city-row:active {
    border-color: #d4d4da !important;
    background: #f7f7f8;
  }

  main :is(.cities-section, .category-city-grid-section) .city-row:active .city-name {
    color: var(--color-primary);
  }

  main :is(.cities-section, .category-city-grid-section) .city-row:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  main .cities-grid :is(.city-count, .city-arrow) {
    display: none;
  }

  /* Narrow phones keep three per row so long names stay whole. */
  @media (max-width: 374px) {
    main :is(.cities-section, .category-city-grid-section) .cities-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    main :is(.cities-section, .category-city-grid-section) .city-row > .city-photo {
      width: 36px;
      height: 36px;
    }
  }

  /* --- Nearby cities on the city page (layout unchanged) --- */
  main .city-nearby .nearby-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    border: 1px solid #d8dadd;
    border-right: 0;
    border-bottom: 0;
  }

  main .city-nearby .nearby-list > a:nth-child(n) {
    display: grid;
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    align-content: center;
    gap: 8px;
    min-width: 0;
    min-height: 52px;
    padding: 12px 4px;
    border: 0;
    border-right: 1px solid #d8dadd;
    border-bottom: 1px solid #d8dadd;
    text-align: center;
  }

  main .city-nearby .nearby-list > a > span {
    min-width: 0;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -.02em;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  main .city-nearby .nearby-list small {
    display: none;
  }

  @media (prefers-reduced-motion: reduce) {
    main .rubricator-grid[data-mobile-rubricator] .rubricator-accordion-body,
    .rubricator-accordion-trigger,
    .rubricator-accordion-icon::before {
      transition: none;
      animation: none;
    }
  }

  main .city-nearby__top {
    margin-bottom: 24px;
  }

  main :is(.standards-layout, .seo-layout, .faq-layout, .city-faq__grid, .city-section-head) {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  main :is(.standards-header, .category-section-head, .city-section-head) {
    margin-bottom: 24px;
  }

  main :is(.method-grid, .method-track) {
    grid-template-columns: minmax(0, 1fr);
    border-bottom: 0;
  }

  main :is(.method-grid, .method-track, .standards-process) > li:nth-child(n) {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-content: start;
    gap: 6px 8px;
    min-height: 0;
    padding: 16px 0;
    border: 0;
    border-bottom: 1px solid #d8dadd;
  }

  main :is(.method-grid, .method-track, .standards-process) > li > span {
    grid-row: 1 / span 2;
    align-self: start;
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
  }

  main :is(.method-grid, .method-track, .standards-process) > li > :is(h3, p, .method-criterion-title, .standards-process-title) {
    grid-column: 2;
    margin: 0;
  }

  main :is(.method-grid, .method-track, .standards-process) :is(h3, .standards-process-title) {
    font-size: 17px;
    line-height: 1.25;
  }

  main .method-grid .method-criterion-title {
    font-size: 17px;
    line-height: 1.25;
  }

  main :is(.method-grid, .method-track, .standards-process) p {
    font-size: 15px;
    line-height: 1.5;
  }

  main :is(.method-proof, .method-callout, .standards-note) {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 24px;
    padding-block: 16px;
  }

  main .method-proof > a {
    white-space: normal;
  }

  main .standards-independence {
    padding: 16px;
  }

  main .standards-independence .btn {
    justify-content: center;
    padding-inline: 12px;
    text-align: center;
    white-space: normal;
  }

  main .editorial-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  main .editorial-grid > article:nth-child(n) {
    min-height: 0;
    padding: 20px 0;
    border-left: 0;
  }

  main .editorial-grid h3 {
    margin-bottom: 8px;
    font-size: 18px;
  }

  main :is(.seo-aside, .faq-header, .city-faq header, .faq-layout > header) {
    position: static;
    min-width: 0;
  }

  main .seo-aside .section-header {
    margin-bottom: 0;
    padding-bottom: 12px;
  }

  main .seo-aside .seo-flow {
    display: none;
  }

  main .seo-article :is(p, p.seo-lead) {
    margin-bottom: 14px;
    font-size: 15px;
    line-height: 1.58;
  }

  main .seo-article p.seo-lead {
    margin-bottom: 16px;
    font-size: 17px;
    line-height: 1.55;
  }

  main .seo-article .seo-quote {
    margin: 20px 0;
    padding: 12px 0 12px 16px;
    font-size: 18px;
    line-height: 1.42;
    text-wrap: pretty;
  }

  main .seo-article > :last-child {
    margin-bottom: 0;
  }

  main :is(.faq-list, .category-faq__list) :is(.faq-trigger, summary) {
    min-height: 48px;
    padding-block: 12px;
    font-size: 16px;
    line-height: 1.35;
  }

  main :is(.faq-list, .category-faq__list) details > p {
    padding-inline-end: 8px;
  }

  main .ranking-sidebar .ranking-filters {
    padding-block: 16px;
  }

  main .ranking-sidebar .ranking-filters fieldset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    margin-bottom: 8px;
  }

  main .ranking-sidebar .ranking-filters label {
    align-items: center;
    min-height: 44px;
    font-size: 13px;
    line-height: 1.2;
  }

  main .ranking-sidebar .filters-reset {
    min-height: 40px;
  }

  /* --- Company cards on phones: compact, white, light type ---
     Grid areas: logo | rank / name, then the summary, a hairline with rating and city, two equal buttons.
     The card wrappers (main, footer row) dissolve with display: contents. */
  .category-layout-v2 main .company-card--compact {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas:
      "logo rank"
      "logo head"
      "sum sum"
      "meta meta"
      "foot foot";
    column-gap: 12px;
    row-gap: 0;
    align-items: center;
    min-height: 0;
    height: auto;
    padding: 14px;
    border: 1px solid #e6e6ea;
    border-radius: 14px;
    background: #fff;
    transform: none;
  }

  /* Taps trigger :hover on phones; the desktop hover rules (red or transparent border) must not leak. */
  .category-layout-v2 main .company-card.company-card--compact:is(:hover, :active, :focus, :focus-within) {
    border-color: #e6e6ea;
    transform: none;
  }

  .category-layout-v2 main .company-card.company-card--compact:focus-visible {
    outline: 2px solid var(--color-title);
    outline-offset: 2px;
  }

  /* Cards without a logo (unfilled profiles, pair cards) use one column. */
  .category-layout-v2 main .company-card--compact:not(:has(> .company-card__logo-wrapper)) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "rank" "head" "sum" "meta" "foot";
  }

  /* Advertising cards: the photo runs across the top. */
  .category-layout-v2 main .company-card--compact.company-card--ad {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "logo" "head" "sum" "meta" "foot";
  }

  .category-layout-v2 main .company-card--compact :is(.company-card__main, .company-card__footer-row) {
    display: contents;
  }

  .category-layout-v2 main .company-card--compact .company-card__rank-column {
    grid-area: rank;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
    width: auto;
    margin: 0 0 2px;
  }

  .category-layout-v2 main .company-card--compact .company-card__rank-column::after {
    display: none;
  }

  .category-layout-v2 main .company-card--compact .company-card__rank-column :is(small, strong) {
    color: #6b7080;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.2;
  }

  .category-layout-v2 main .company-card--compact .company-card__logo-wrapper {
    grid-area: logo;
    align-self: center;
    width: 48px;
    height: 48px;
    margin: 0;
    border-radius: 12px;
    background: #f4f4f5;
  }

  .category-layout-v2 main .company-card--pair .company-card__logo-wrapper--placeholder {
    display: flex;
  }

  .category-layout-v2 main .company-card--compact .company-card__logo-monogram {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -.02em;
  }

  .category-layout-v2 main .company-card--compact .company-card__logo-img {
    max-width: 38px;
    max-height: 22px;
  }

  .category-layout-v2 main .company-card--ad .company-card__logo-wrapper--ad {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 7;
    margin: 0 0 12px;
    overflow: hidden;
  }

  .category-layout-v2 main .company-card--compact .company-card__header-row {
    grid-area: head;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .category-layout-v2 main .company-card--compact .company-card__title {
    min-width: 0;
    color: #0d0e12;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -.01em;
  }

  .category-layout-v2 main .company-card--compact .verified-badge {
    flex: 0 0 auto;
    height: 18px;
  }

  .category-layout-v2 main .company-card--compact .company-card__meta {
    grid-area: meta;
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 4px 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #efeff2;
    color: #6b7080;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    white-space: normal;
  }

  .category-layout-v2 main .company-card--compact .company-meta-city {
    min-width: 0;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Rating on the left, city on the right. */
  .category-layout-v2 main .company-card--compact .company-meta-rating {
    order: -1;
  }

  .category-layout-v2 main .company-card--compact .company-summary {
    grid-area: sum;
    display: -webkit-box;
    max-width: none;
    margin: 10px 0 0;
    overflow: hidden;
    color: #4b5162;
    font-size: 14px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  /* The unfilled-profile prompt is short and must stay whole. */
  .category-layout-v2 main .company-card--compact:is(.company-card--incomplete, :not(:has(> .company-card__logo-wrapper))) .company-summary {
    display: block;
    font-size: 13px;
  }

  .category-layout-v2 main .company-card--compact footer {
    grid-area: foot;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    margin-top: 10px;
  }

  /* White cards on phones: a lighter grey than on the grey desktop cards. */
  .category-layout-v2 main .company-card--compact footer .company-contact {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 0 12px;
    background: #f1f1f3;
    font-size: 14px;
    white-space: nowrap;
  }

  .category-layout-v2 main .company-card--compact footer .company-profile {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    min-width: 0;
    min-height: 40px;
    font-size: 14px;
    white-space: nowrap;
  }

  /* ===== Company profile on phones ===== */

  /* Section rhythm */
  .profile-v3 main > section:not(.profile-company-banner, .profile-hero) {
    padding-block: 48px;
  }

  .profile-v3 .profile-section-head {
    gap: 0;
    margin-bottom: 0;
  }

  .profile-v3 .profile-section-head h2,
  .profile-v3 .profile-two-column h2,
  .profile-v3 .review-layout h2,
  .profile-v3 .review-form-layout h2 {
    font-size: clamp(28px, 7.6vw, 34px);
    font-weight: 500;
    line-height: 1.12;
  }

  /* Title: the name and the verified badge always fit the screen. */
  .profile-v3 .profile-title-rank-row {
    flex-wrap: nowrap;
    gap: 12px;
  }

  .profile-v3 .profile-title-rank-row h1 {
    min-width: 0;
    font-size: clamp(30px, 9.6vw, 44px);
  }

  .profile-v3 .profile-title-rank-row .profile-verified-badge {
    flex: 0 0 auto;
  }

  /* Phone row: the number has an inline 27 px size; keep number and button on one line. */
  .profile-v3 #phone-container > div {
    flex-wrap: nowrap;
  }

  .profile-v3 #phone-container :is(span, a) {
    font-size: clamp(20px, 6.2vw, 26px) !important;
    white-space: nowrap;
  }

  .profile-v3 #phone-container .phone-reveal-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Intro: the first lines, the rest behind «Читать подробнее» */
  .profile-v3 .profile-tagline {
    font-size: 15px;
    line-height: 1.5;
  }

  .profile-v3 .profile-tagline.is-clamped {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  /* The hero column is a flex stack with a 24 px gap: the toggle sits close to the text, the button follows. */
  .profile-v3 .profile-hero .profile-actions {
    margin-top: -8px;
  }

  .profile-v3 .profile-hero .profile-tagline-toggle {
    margin-top: -16px;
  }

  .profile-v3 .review-list article header .review-meta time {
    white-space: nowrap;
  }

  .profile-tagline-toggle:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    margin-top: 2px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-title);
    font: 500 15px/1.2 var(--font-body);
    text-decoration: underline;
    text-decoration-color: rgba(13, 14, 18, .25);
    text-underline-offset: 4px;
    cursor: pointer;
  }

  .profile-tagline-toggle svg {
    flex: 0 0 16px;
    transition: transform .2s ease;
  }

  .profile-tagline-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
  }

  /* Section tabs: one scrollable row of chips, like the quick filters */
  .profile-v3 .profile-section-nav {
    min-height: 0;
    padding-block: 12px;
    border-top: 0;
  }

  .profile-v3 .profile-section-nav .profile-section-links {
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 0;
    margin-right: 0;
    padding-right: 16px;
    overflow-x: auto;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }

  .profile-v3 .profile-section-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: #f1f1f3;
    color: var(--color-title);
    font-size: 14px;
    white-space: nowrap;
  }

  .profile-v3 .profile-section-nav a:hover,
  .profile-v3 .profile-section-nav a[aria-current="location"] {
    border: 0;
    background: var(--color-title);
    color: #fff;
  }

  /* Price list: a list of rows, no table scrolling */
  .profile-v3 .services-table-wrapper {
    margin-top: 20px;
    overflow: visible;
  }

  .profile-v3 .services-table,
  .profile-v3 .services-table tbody {
    display: block;
  }

  .profile-v3 .services-table thead {
    display: none;
  }

  /* Each service reads top-down: the name, then the price with its unit on one line. */
  .profile-v3 .services-table tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 4px;
    align-items: baseline;
    padding: 12px 0;
    border-bottom: 1px solid #efeff2;
  }

  .profile-v3 .services-table tbody tr[style*="display: none"] {
    display: none !important;
  }

  .profile-v3 .services-table td {
    padding: 0;
    border: 0;
    text-align: left;
  }

  .profile-v3 .services-table td:first-child {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .profile-v3 .services-table td .service-name {
    color: var(--p-ink);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.35;
  }

  .profile-v3 .services-table td.service-price-col {
    grid-column: 1;
    grid-row: 2;
    color: var(--p-ink);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
  }

  .profile-v3 .services-table td.service-unit-col {
    grid-column: 2;
    grid-row: 2;
    color: var(--p-muted);
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
  }

  .profile-v3 .services-footer {
    justify-content: stretch;
    margin-top: 20px;
  }

  .profile-v3 .services-footer .btn {
    width: 100%;
    justify-content: center;
  }

  /* Gallery and documents: swipeable cards, arrows centred under the track */
  .profile-v3 :is(#projects, #documents) > .container {
    display: flex;
    flex-direction: column;
  }

  .profile-v3 :is(#projects, #documents) .profile-section-head {
    display: contents;
  }

  .profile-v3 :is(#projects, #documents) .projects-header-side {
    order: 3;
    justify-content: center;
    margin-top: 16px;
  }

  .profile-v3 :is(.project-showcase, .documents-showcase) {
    order: 2;
    margin-top: 20px;
    margin-right: -16px;
    padding-right: 16px;
    scroll-padding-inline: 0;
  }

  /* profile.css sets grid-template-columns: 1fr at 780 px, which squeezed the first card to 2 px. */
  .profile-v3 .project-showcase {
    grid-template-columns: none;
    grid-auto-columns: 80%;
    gap: 12px;
  }

  .profile-v3 .project-showcase article {
    border-radius: 14px;
  }

  .profile-v3 .project-card-body {
    justify-content: flex-start;
    padding: 14px 16px 16px;
  }

  .profile-v3 .project-card-body h3 {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -.01em;
  }

  .profile-v3 .documents-showcase {
    grid-template-columns: none;
    grid-auto-columns: 62%;
    gap: 12px;
  }

  .profile-v3 .document-cover {
    border-radius: 12px;
  }

  /* Reviews: separate cards with the author on top */
  .profile-v3 :is(.review-layout, .review-form-layout) {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-v3 .review-layout {
    gap: 24px;
  }

  .profile-v3 .review-score {
    margin-top: 20px;
    padding: 14px 0;
  }

  .profile-v3 .review-score strong {
    font-size: 44px;
  }

  .profile-v3 .review-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
    border-top: 0;
  }

  .profile-v3 .review-copy-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-v3 .review-list article {
    padding: 16px;
    border: 1px solid #e6e6ea;
    border-radius: 14px;
  }

  .profile-v3 .review-list article header strong {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.25;
  }

  .profile-v3 .review-list article header .review-avatar {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  .profile-v3 .review-list article header .review-score-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(245, 27, 36, .08);
    font-size: 15px;
    font-weight: 500;
  }

  .profile-v3 .review-copy-grid {
    margin-top: 12px;
    border: 0;
  }

  .profile-v3 .review-copy-grid > div,
  .profile-v3 .review-copy-grid > div + div {
    padding: 10px 0 0;
    border: 0;
  }

  .profile-v3 :is(.review-copy-grid, .review-result-copy) small {
    font-size: 13px;
    font-weight: 500;
  }

  .profile-v3 :is(.review-copy-grid, .review-result-copy) p {
    margin-top: 4px;
    font-size: 14px;
    line-height: 1.5;
  }

  .profile-v3 .review-result-copy {
    margin-top: 12px;
    padding: 10px 0 0 12px;
    border-left-width: 2px;
  }

  .profile-v3 .review-more {
    margin-top: 4px;
  }

  /* Review form: compact, name and email side by side */
  .profile-v3 .review-form-layout {
    gap: 20px;
  }

  .profile-v3 .profile-review-form {
    gap: 16px;
    padding-top: 16px;
  }

  .profile-v3 .profile-review-form label,
  .profile-v3 .review-rating-field legend {
    font-size: 14px;
    font-weight: 500;
  }

  .profile-v3 .review-rating-field {
    padding-bottom: 14px;
  }

  .profile-v3 .review-rating-field div {
    gap: 6px;
    margin-top: 8px;
  }

  .profile-v3 .review-rating-field label {
    width: 44px;
    height: 40px;
    border-radius: 10px;
  }

  .profile-v3 .review-form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .profile-v3 .profile-review-form :is(input[type="text"], input[type="email"], textarea) {
    min-height: 44px;
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 15px;
  }

  .profile-v3 .review-experience-grid {
    gap: 16px;
  }

  .profile-v3 :is(.review-experience-grid label, .review-result-field) {
    padding: 0;
    border: 0;
  }

  .profile-v3 .profile-review-form :is(.review-experience-grid, .review-result-field) textarea {
    height: 96px;
    min-height: 96px;
    margin-top: 6px;
  }

  .profile-v3 .profile-review-form label > small {
    margin-top: 2px;
  }

  .profile-v3 .review-form-submit {
    gap: 14px;
  }

  /* Contacts: social icons in one larger row */
  .profile-v3 .contact-panel .contact-social-grid {
    grid-template-columns: repeat(6, 44px) !important;
    gap: 10px !important;
  }

  .profile-v3 .contact-panel .contact-social-grid > a {
    width: 44px !important;
    height: 44px !important;
  }

  .profile-v3 .contact-panel .contact-social-grid svg {
    width: 20px;
    height: 20px;
  }

  @media (max-width: 359px) {
    .profile-v3 .contact-panel .contact-social-grid {
      grid-template-columns: repeat(6, 38px) !important;
      gap: 8px !important;
    }

    .profile-v3 .contact-panel .contact-social-grid > a {
      width: 38px !important;
      height: 38px !important;
    }

    .profile-v3 .review-form-row {
      grid-template-columns: minmax(0, 1fr);
    }
  }
}

@media (max-width: 768px) {
  .category-layout-v2 .pagination {
    gap: 6px;
    width: calc(100% + 24px);
    margin-right: -12px;
    margin-left: -12px;
    margin-top: 40px;
  }

  .category-layout-v2 .pagination :is(a, button, span) {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
  }

  .category-layout-v2 .pagination .pagination__ellipsis {
    width: 18px;
    flex-basis: 18px;
    border-color: transparent;
  }
}

@media (max-width: 390px) {
  .category-layout-v2 .pagination {
    gap: 6px;
  }

  .category-layout-v2 .pagination :is(a, button, span) {
    width: 44px;
    flex-basis: 44px;
  }

  .category-layout-v2 .pagination .pagination__ellipsis {
    width: 14px;
    flex-basis: 14px;
  }
}

/* Production ranking markup: keep the same mobile rhythm as the reference pages. */
@media (max-width: 768px) {
  body.ranking-city-page .ranking-toolbar {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .category-layout-sidebar .ranking-filter-form--with-sidebar {
    display: block;
  }

  .category-layout-sidebar .ranking-filter-form--with-sidebar > .ranking-sidebar {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    width: 100%;
    height: 100dvh;
    padding: 0 20px 24px;
    overflow-y: auto;
    background: #fff;
  }

  .category-layout-sidebar .ranking-filter-form--with-sidebar > .ranking-sidebar.is-open {
    display: block;
  }

  .category-layout-sidebar .ranking-sidebar.is-open .ranking-sidebar__disclosure {
    display: block;
    border: 0;
  }

  .category-layout-sidebar .ranking-sidebar.is-open .ranking-sidebar__disclosure > summary {
    display: none;
  }

  .category-layout-sidebar .ranking-sidebar.is-open .ranking-sidebar__content {
    padding: 16px 0 96px;
  }

  .category-layout-sidebar .ranking-filter-form__main > .ranking-results {
    margin-top: 0;
  }

  .category-layout-sidebar .ranking-sidebar.is-open fieldset {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .category-layout-sidebar .ranking-sidebar.is-open fieldset label {
    min-height: 52px;
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f2;
    color: var(--color-title);
    font-size: 16px;
  }

  /* Catalog fallback cards keep the same compact composition as ranked cards. */
  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas:
      "logo head"
      "sum sum"
      "meta meta"
      "foot foot";
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-card__logo-wrapper {
    width: 48px;
    height: 48px;
    margin: 0;
    border-radius: 12px;
    background: #f4f4f5;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-card__main {
    display: contents;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-card__footer-row {
    display: contents;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-card__meta {
    order: initial;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-card__catalog-actions {
    grid-area: foot;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-top: 10px;
    gap: 8px;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) :is(.company-catalog-contact, .company-profile) {
    display: inline-flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    justify-content: center;
    border-radius: 999px;
    text-align: center;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-card__catalog-actions > :only-child {
    grid-column: 1 / -1;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-catalog-contact {
    border: 0;
    background: #ededf0;
    color: #0d0e12;
  }

  .category-layout-v2 .company-card--catalog:not(.company-card--catalog-company) .company-profile {
    border: 0;
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
}
