/* Recovered CSS: complete original blocks plus reconstructed gaps. */
.score span {
  font-size: 32px;
  font-weight: 700;
  color: #55677d;
}

.score strong {
  font-size: 46px;
  line-height: 1;
}

.reviews-intro {
  color: #40536b !important;
}

.reviews-slider {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.review-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 8px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.review-track::-webkit-scrollbar {
  display: none;
}

.review {
  flex: 0 0 min(360px, 84vw);
  scroll-snap-align: start;
  margin: 0;
}

.slider-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(25,56,90,.08);
  transition: transform .2s, box-shadow .2s, background .2s;
}

.slider-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(25,56,90,.12);
  background: #f9fbff;
}

@media (max-width: 620px) {
  .button {
    width: 100%;
    padding: 15px 18px;
  }

  .score span {
    font-size: 26px;
  }

  .score strong {
    font-size: 42px;
  }

  .reviews-slider {
    grid-template-columns: 1fr;
  }

  .slider-button {
    display: none;
  }

  .review {
    flex-basis: 86vw;
  }

  .teacher-modal {
    width: min(100% - 16px, 760px);
    max-height: 92vh;
    border-radius: 24px;
  }

  .modal-photo {
    height: min(42vh, 360px);
  }

  .modal-copy {
    padding: 22px 22px 28px;
  }

  .cta-messengers {
    grid-template-columns: 1fr 1fr;
  }

  .footer-caption {
    font-size: 14px;
  }
}

/* ===== Mobile / Safari hardening ===== */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
}

.teacher-modal {
  max-height: min(92vh, 940px);
  max-height: min(92dvh, 940px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.teacher-modal .modal-copy {
  overflow: visible;
}

.modal-inner {
  min-height: 0;
}

.modal-gallery {
  flex-shrink: 0;
}

.gallery-nav,
.slider-button,
.modal-close {
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.teacher-media {
  -webkit-tap-highlight-color: transparent;
}

.review-track {
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.results-grid {
  -webkit-overflow-scrolling: touch;
}

.button,
.messenger-pill,
.footer-icon,
.text-button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  -webkit-backdrop-filter: blur(18px);
}

.footer {
  padding-bottom: max(42px, env(safe-area-inset-bottom));
}

@supports (height: 100dvh) {
  .body-modal-lock {
    height: 100dvh;
  }
}

@media (max-width: 620px) {
  .teacher-modal {
    max-height: 92vh;
    max-height: 92dvh;
  }

  .modal-photo {
    height: min(42vh, 360px);
    height: min(42dvh, 360px);
  }

  .review-track {
    scroll-padding-inline: 0;
  }

  .cta-shell {
    overflow: hidden;
  }

  .cta-messengers > *,
  .cta-actions > * {
    min-width: 0;
  }
}

/* ===== Gallery performance polish ===== */

.teacher-media,
.modal-gallery {
  contain: layout paint;
}

.teacher-photo,
.modal-photo {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  transform: translateZ(0) scale(1);
  -webkit-transform: translateZ(0) scale(1);

  transition:
    opacity 160ms ease,
    transform 160ms ease;

  will-change: opacity, transform;

  user-select: none;
  -webkit-user-select: none;

  -webkit-user-drag: none;
}

.teacher-photo.is-switching,
.modal-photo.is-switching {
  opacity: .72;
  transform: translateZ(0) scale(.995);
}

.teacher-media,
.modal-gallery {
  touch-action: pan-y;
}

.gallery-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;

  will-change: transform;
}

.gallery-nav:hover {
  transform: translateY(-50%) scale(1.06);
}

.gallery-nav:active {
  transform: translateY(-50%) scale(.96);
}

.reveal,
.reveal.visible {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/*
 * Старый mobile CSS скрывал отзывы начиная с четвёртого.
 * В slider-track показываем абсолютно все отзывы.
 */
.review-track .review,
.review-track .review:nth-child(n+4) {
  display: block !important;
}

.teacher-media,
.modal-gallery {
  background: #f3f6fa;
}

/*
 * Отзывы: нативная горизонтальная прокрутка.
 */
.review-track {
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

/*
 * Не даём Safari подсвечивать элементы при tap.
 */
.gallery-nav,
.teacher-media,
.review-track,
.slider-button {
  -webkit-tap-highlight-color: transparent;
}

/*
 * Модалка должна скроллиться как единый документ.
 */
.teacher-modal {
  overflow-y: auto !important;
  overflow-x: hidden !important;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.teacher-modal .modal-inner,
.teacher-modal .modal-copy {
  overflow: visible !important;
}

@media (max-width: 620px) {
  .teacher-media .gallery-nav,
  .modal-gallery .gallery-nav {
    width: 32px !important;
    height: 32px !important;

    min-width: 32px !important;
    min-height: 32px !important;

    max-width: 32px !important;
    max-height: 32px !important;

    inline-size: 32px !important;
    block-size: 32px !important;

    font-size: 21px;
  }

  .teacher-media .gallery-prev,
  .modal-gallery .gallery-prev {
    left: 7px;
  }

  .teacher-media .gallery-next,
  .modal-gallery .gallery-next {
    right: 7px;
  }

  .review-track .review,
  .review-track .review:nth-child(n+4) {
    display: block !important;
    flex: 0 0 86vw;
  }
}

/* =========================================================
   COMPACT REVIEWS
   ========================================================= */

.review {
  display: flex !important;
  flex-direction: column;
  min-height: 0;
}

.review-copy {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.review-text {
  margin: 0;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;

  overflow: hidden;
}

.review.is-expanded .review-text {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.review-toggle {
  align-self: flex-start;

  margin-top: 12px;
  padding: 0;

  border: 0;
  background: transparent;

  color: var(--blue);
  font: inherit;
  font-size: 14px;
  font-weight: 750;

  cursor: pointer;

  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.review-toggle:hover {
  text-decoration: underline;
}

.review footer {
  margin-top: 18px;
}

@media (max-width: 620px) {
  .review-text {
    -webkit-line-clamp: 7;
  }
}

.results-page-status {
  min-width: 48px;

  color: rgba(255,255,255,.82);

  text-align: center;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .04em;
}


/* ---------- Review rating ---------- */

.review-stars {
  display: flex;
  align-items: center;
  gap: 3px;

  margin-bottom: 14px;

  color: #111827;
}

.review-stars svg {
  display: block;

  width: 16px;
  height: 16px;

  fill: currentColor;
}


/* ---------- Privacy: structural mobile fix ---------- */

.privacy-page,
.privacy-page * {
  box-sizing: border-box;
}

html:has(.privacy-page),
.privacy-page {
  width: 100%;
  max-width: 100%;

  overflow-x: hidden;
}

@supports (overflow: clip) {
  html:has(.privacy-page),
  .privacy-page {
    overflow-x: clip;
  }
}

.privacy-main,
.privacy-document,
.privacy-heading,
.privacy-text {
  min-width: 0;
  max-width: 100%;
}

.privacy-heading h1 {
  max-width: 100%;

  overflow-wrap: anywhere;
  word-break: normal;
}

.privacy-text {
  overflow-wrap: break-word;
  word-break: normal;
}

@media (max-width: 620px) {
  #results .results-grid {
    display: flex;

    gap: 14px;

    overflow-x: auto;
    overflow-y: hidden;

    /* The mobile container leaves 14px on each side. Match its gutter. */
    margin-left: -14px;
    margin-right: -14px;

    padding:
      2px
      14px
      13px;

    scroll-snap-type: x mandatory;
    scroll-padding-left: 14px;

    overscroll-behavior-inline: contain;

    -webkit-overflow-scrolling: touch;

    scrollbar-width: none;
  }

  #results .results-grid::-webkit-scrollbar {
    display: none;
  }

  #results .result-card {
    flex:
      0
      0
      min(82vw, 350px);

    min-width: 0;

    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }

  #results .results-pagination {
    display: none !important;
  }
}

.footer-clean {
  min-height: 118px;

  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;

  gap: 28px;

  padding: 25px 30px;

  border: 1px solid var(--line);
  border-radius: 25px;

  background: #fff;

  box-shadow:
    0 12px 38px rgba(18,52,89,.055);
}

.footer-logo {
  display: flex;
  align-items: center;
}

.footer-logo img {
  width: 118px;
  height: auto;
}

.footer-disciplines {
  margin: 0;

  color: var(--muted);
  font-size: 15px;
}

.footer-meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 5px;

  font-size: 13px;
  color: var(--muted);
}
.footer-meta a {
  color: var(--ink);
  font-weight: 650;
}

.footer-meta a:hover {
  color: var(--blue);
}


/* ----- Privacy ----- */

.privacy-main {
  padding: 72px 0 100px;
}

.privacy-document {
  max-width: 920px;
}

.privacy-heading {
  margin-bottom: 42px;
}

.privacy-heading h1 {
  margin: 0;

  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.04;
  letter-spacing: -.045em;
}

.privacy-text {
  padding: 38px 42px;

  border: 1px solid var(--line);
  border-radius: 26px;

  background: #fff;

  color: #42536a;

  font-size: 16px;
  line-height: 1.78;

  box-shadow:
    0 14px 44px rgba(25,56,90,.055);
}


/* ----- Cookie banner ----- */

.cookie-banner[hidden] {
  display: none !important;
}

.cookie-banner {
  position: fixed;
  z-index: 1000;

  left: 0;
  right: 0;
  bottom: 0;

  padding:
    14px
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));

  pointer-events: none;

  opacity: 0;
  transform: translateY(12px);

  transition:
    opacity .18s ease,
    transform .18s ease;
}

.cookie-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.cookie-banner-inner {
  width: min(100%, 1040px);
  margin: auto;

  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;

  gap: 24px;

  padding: 18px 20px;

  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;

  background: rgba(13,29,53,.96);
  color: #fff;

  box-shadow:
    0 20px 60px rgba(0,0,0,.24);

  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);

  pointer-events: auto;
}

.cookie-banner p {
  margin: 0;

  font-size: 14px;
  line-height: 1.55;

  color: #dfe8f7;
}

.cookie-banner a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-accept {
  min-width: 110px;
  min-height: 46px;

  padding: 0 20px;

  border: 0;
  border-radius: 13px;

  background: var(--blue);
  color: #fff;

  font: inherit;
  font-weight: 800;

  cursor: pointer;
}

/* Reconstructed parts of the approved UI. */
[hidden] { display: none !important; }
#results .result-card { display: flex; flex-direction: column; justify-content: flex-start; }
#results .result-card h3 { margin: 0 0 4px; }
#results .score { margin: 22px 0 0; }
#results .result-card small { margin-top: 12px; }
#results .result-card[hidden] { display:none !important; }
.results-pagination { display:flex; align-items:center; justify-content:center; gap:14px; margin:24px 0 0; }
.results-pagination button { width:42px; height:42px; border:1px solid #ffffff66; border-radius:50%; background:#ffffff1a; color:white; cursor:pointer; font-size:20px; }
.results-pagination button:disabled { opacity:.35; cursor:default; }
.review-track { min-width:0; overflow-y:hidden; touch-action:pan-x pan-y; }
.reviews-slider { min-width:0; grid-template-columns:auto minmax(0,1fr) auto; }
.review-track .review,.review-track .review:nth-child(n+4) { display:flex !important; flex-direction:column; }
.review-toggle[hidden] { display:none!important; }
.teacher-media,.modal-gallery { position:relative; overflow:hidden; min-width:0; background:#f3f6fa; }
.teacher-card .teacher-media { aspect-ratio:4/4.6; }
.teacher-card .teacher-photo { width:100%; height:100%; object-fit:cover; aspect-ratio:auto; }
.modal-inner { display:flex; flex-direction:column; }
.modal-gallery .modal-photo { width:100%; height:min(52vh,520px); object-fit:contain; background:#07509e; }
/* A zero-height sticky control layer overlays the gallery without consuming its width. */
.modal-tools { position:sticky; top:0; height:0; z-index:5; }
.modal-tools .modal-close { position:absolute; top:12px; right:12px; float:none; margin:0; padding:0; width:44px; height:44px; display:grid; place-items:center; line-height:1; }
.modal-tools .modal-close-icon { display:block; width:20px; height:20px; pointer-events:none; }
.gallery-nav { position:absolute; top:50%; transform:translateY(-50%); z-index:2; width:34px; height:34px; min-width:34px; min-height:34px; border:0; border-radius:50%; background:rgba(255,255,255,.9); color:#233c57; cursor:pointer; font-size:0!important; }
.gallery-prev {left:12px;} .gallery-next {right:12px;}
.gallery-nav::before {content:""; position:absolute; top:50%; left:50%; width:9px;height:9px; border-top:2px solid currentColor; border-right:2px solid currentColor; transform-origin:center; }
.gallery-next::before {transform:translate(-65%,-50%) rotate(45deg);}
.gallery-prev::before {transform:translate(-35%,-50%) rotate(-135deg);}
.gallery-dots { position:absolute; bottom:10px; left:0; right:0; display:flex; align-items:center; justify-content:center; gap:5px; z-index:1; pointer-events:none; }
.gallery-dot { width:6px;height:6px; border-radius:50%; background:rgba(255,255,255,.55); box-shadow:0 1px 4px #0003; }
.gallery-dot.is-active {background:#fff; transform:scale(1.25); }
.cta-messengers { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.messenger-pill { display:flex; justify-content:center; align-items:center; gap:8px; min-height:54px; padding:10px 12px; background:#ffffff16; border:1px solid #ffffff30; border-radius:15px; color:#fff; font-size:14px; font-weight:750; }
.messenger-pill:hover { background:#ffffff2b; }
.messenger-pill img { width:20px; height:20px; object-fit:contain; }
.cta-phone { display:flex; flex-direction:column; align-items:center; text-align:center; color:white; gap:3px; }
.cta-phone span { font-size:12px; color:#cfe0ff; } .cta-phone strong {font-size:19px;}
.footer-meta {color:var(--muted);}
.site-header .brand { flex-shrink:0; }
.site-header .button-small { flex-shrink:0; width:auto; }
@media(max-width:620px) {
  #results .results-grid { min-width:0; touch-action:pan-x pan-y; }
  #results .result-card { min-height:210px; }
  .reviews-slider { grid-template-columns:minmax(0,1fr); }
  .review-track .review { flex:0 0 min(86vw,360px); min-width:0; }
  .teacher-card .teacher-media { height:100%; min-height:128px; aspect-ratio:auto; }
  .teacher-card .teacher-body>p:not(.teacher-subjects) {display:block; margin:6px 0; font-size:12px; line-height:1.45;}
  .teacher-card .teacher-media .gallery-nav {display:none!important;}
  .teacher-card .teacher-media {cursor:pointer;}
  .teacher-card .teacher-media .gallery-dots {gap:3px; bottom:7px;}
  .teacher-card .teacher-media .gallery-dot {width:4px;height:4px;}
  .modal-gallery .modal-photo { height:min(42vh,360px); height:min(42dvh,360px); }
  .modal-gallery .gallery-nav::before {width:7px;height:7px;}
  .footer-clean { grid-template-columns:1fr; justify-items:center; text-align:center; gap:12px; padding:24px 16px; }
  .footer-meta {align-items:center; text-align:center;}
  .footer-disciplines {font-size:13px;}
  .privacy-main {padding:36px 0 56px;}
  .privacy-heading {margin-bottom:24px;}
  .privacy-heading h1 {font-size:clamp(26px,8vw,38px);}
  .privacy-text {padding:20px; font-size:15px; line-height:1.7;}
  .privacy-page .nav-shell {display:flex; justify-content:space-between; align-items:center; gap:14px;}
  .privacy-page .brand {flex:0 0 auto;}
  .privacy-page .privacy-back {width:auto; min-height:38px; padding:0 13px; font-size:13px; white-space:nowrap;}
  .cookie-banner-inner {grid-template-columns:1fr; gap:12px; padding:16px;}
  .cookie-banner p {font-size:13px;}
  .cookie-accept {width:100%;}
  body:not(.privacy-page) .site-header .button-small {min-height:48px; padding:0 22px!important; display:inline-flex; align-items:center; justify-content:center; font-size:17px!important;line-height:1!important;font-weight:800;white-space:nowrap;}
}
@media(max-width:370px) {
  body:not(.privacy-page) .site-header .button-small {min-height:46px;padding-inline:18px!important;font-size:16px!important;}
  .site-header .nav-shell {gap:10px;}
}
@media(prefers-reduced-motion:reduce) { .review-track {scroll-behavior:auto;} }
