/* ===== DOCTORS ARCHIVE ===== */
.sm-doctors-title{ margin:0 0 24px 0; }

/* Фильтры */
.sm-filters{ display:flex; flex-wrap:wrap; row-gap: 20px; column-gap: 40px;  margin-bottom:32px; }
.sm-filter{ display:flex; flex-direction:column; row-gap:8px; max-width:100%; position:relative; }
.sm-filter__label{ color:var(--sm-muted); line-height:1.4; }

/* Кнопки-фильтры */
.sm-filter__button{
  width:500px; max-width:100%;
  appearance:none; -webkit-appearance:none;
  background:var(--sm-on-brand) !important; color:var(--sm-muted);
  border:1px solid var(--sm-muted); border-radius:999px;
  padding:12px 24px;
  display:flex; align-items:center; justify-content:space-between; gap:0px;
  cursor:pointer; position:relative;
  box-shadow:none; text-shadow:none; background-image:none;
  transition:border-color .2s ease, color .2s ease, background-color .2s ease;
}
.sm-filter__button:hover,
.sm-filter__button:focus,
.sm-filter__button:active{
  background:var(--sm-on-brand) !important; border-color:var(--sm-text)	; color:var(--sm-muted); outline:none;
}
.sm-filter__button.is-selected .sm-filter__text{ color:var(--sm-text); }

/* Текст прижат влево, занимает всё свободное место */
.sm-filter__text{
  color:inherit;
  flex:1 1 auto;
  text-align:left;
}

/* Иконка прижата вправо, фиксированный размер */
.sm-filter__icon{
  flex:0 0 auto;
  width:18px; height:18px;
  margin-left:12px;                  /* небольшой отступ от текста */
  transition:transform .2s ease;
}


/*.sm-filter__icon{ width:18px; height:18px; transition:transform .2s ease; } */

.sm-filter__button[aria-expanded="true"] .sm-filter__icon{ transform:rotate(90deg); }


/* Выпадающее меню в фильтрах */
.sm-filter__menu{
  display:none; position:absolute; top:calc(100% + 10px); left:0;
  width:500px; max-width:100%; height:364px; background:var(--sm-on-brand);
  box-shadow:0 0 10px var(--sm-shadow); border-radius:16px; padding:8px 0;
  z-index:999; overflow-y:auto; -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
}
.sm-filter__menu.is-open{ display:block; }
.sm-filter__item{
  display:block; padding:12px 20px; color:var(--sm-text); text-decoration:none; line-height:1.4;
}

/* 1) БАЗА для ссылок — должна идти ПЕРЕД hover */
.sm-filter__menu .sm-filter__item:link,
.sm-filter__menu .sm-filter__item:visited{
  color: var(--sm-text);
}


/* 2) Ховер/фокус — идёт ПОСЛЕ, чтобы перекрыть базу */
.sm-filter__menu .sm-filter__item:hover,
.sm-filter__menu .sm-filter__item:focus,
.sm-filter__menu .sm-filter__item:focus-visible{
  color: var(--sm-brand);
  background: var(--sm-on-brand);
  text-decoration: none;
  outline: none;
}

/* 3) Активный (текущий) пункт — фиксируем и сохраняем при hover */
.sm-filter__menu .sm-filter__item.is-active,
.sm-filter__menu .sm-filter__item[aria-current="true"]{
  color: var(--sm-brand);
  background: var(--sm-surface-2);
  font-weight: 600;
}
.sm-filter__menu .sm-filter__item.is-active:hover,
.sm-filter__menu .sm-filter__item[aria-current="true"]:hover{
  color: var(--sm-brand);
  background: var(--sm-surface-2);
}


/* Скроллбар стандартный кастомизированный*/

.sm-filter__menu::-webkit-scrollbar{ width:3px; }
.sm-filter__menu::-webkit-scrollbar-thumb{ background:var(--sm-muted); border-radius:3px; }
.sm-filter__menu::-webkit-scrollbar-track{ background:transparent; margin:10px; }


/* ===== Скрываем стандартный скрол использщуем js скролбар из doctors-archive.js ===== */

/* Прячем нативный скролл, включаем кастомный для меню 
.sm-filter__menu.sm-scroll--custom {
  scrollbar-width: none; 
}
.sm-filter__menu.sm-scroll--custom::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
}

*/

/* Наш трек и "ползунок" поверх списка 
.sm-filter__menu .sm-scrollbar {
  position: absolute;
  top: 10px;              
  bottom: 10px;
  right: 10px;
  width: 3px;
  pointer-events: none;    /* чтобы не перекрывать клики по пунктам 
}
.sm-filter__menu .sm-scrollbar__thumb {
  position: absolute;
  left: 0;
  width: 3px;
  height: 49px;            /* фиксированная высота 
  background: var(--sm-brand);
  border-radius: 2px;
}
*/

/* ===== GRID ===== */
.sm-doctors-grid{
  display:grid;
  grid-template-columns: 1fr; /* mobile default */
  gap:24px;
}
@media (min-width:545px){ .sm-doctors-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); } } /* tablet ≥545 */
@media (min-width:922px){ .sm-doctors-grid{ grid-template-columns: repeat(4, minmax(0,1fr)); } } /* desktop ≥922 */

/* Перебиваем Astra, чтобы карточки растягивались */
.sm-doctors-grid > article,
.sm-doctors-grid > .ast-article-post,
.sm-doctors-grid > .ast-grid-common-col{
  margin:0 !important; width:100% !important; justify-self:stretch; align-self:stretch;
}

/* ===== CARD ===== */
.sm-doctor-card{
  background: var(--sm-on-brand);
  border-radius:20px;
  border:1px solid transparent;
  overflow:hidden;                 /* обрезаем углы у медиа */
  box-shadow: 0 8px 24px var(--sm-shadow);
  transition: box-shadow .2s ease, border-color .2s ease;
  height:100%;
  display:flex; 
  flex-direction:column;
}
.sm-doctor-card:hover{ box-shadow:none; border-color: var(--sm-surface-subtle); }

/* Медиа: квадрат, отступ 10px (8px моб.), ширина с учётом отступов */
.sm-doctor-card__thumb{
  position: relative;
  width: calc(100% - 20px);   /* 100% - 10px слева - 10px справа */
  margin: 10px;               /* отступ по периметру */
  aspect-ratio: 1 / 1;        /* квадрат */
  border-radius: 14px;        /* скругление картинки */
  overflow: hidden;
  background: var(--sm-on-brand);
}
@media (max-width:544px){
  .sm-doctor-card__thumb{
    width: calc(100% - 16px); /* 100% - 8px - 8px */
    margin: 8px;
    border-radius: 12px;
  }
}
.sm-doctor-card__img{ width:100%; height:100%; object-fit:cover; display:block; }
.sm-no-thumb{ width:100%; height:100%; background:#E9EDF5; }

/* Контент: top 0, sides/bottom 24 (моб. 16); растягиваем блок */
.sm-doctor-card__body{
  display:flex; 
  flex-direction:column;
  flex: 1 1 auto;                /* тянем тело, чтобы кнопка ушла вниз */
  padding: 0 24px 24px !important;
}
@media (max-width:544px){
  .sm-doctor-card__body{ padding: 0 16px 16px !important; }
}

/* Заголовок и главная специальность */
.sm-doctor-card__title{
  color: var(--sm-headline);
  margin:0 0 12px 0;             /* верх 0, низ 12 */
}
.sm-doctor-card__spec{
  color: var(--sm-muted);
  margin:0 0 12px 0;
}

/* Клиники */
.sm-doctor-card__clinics{
  display:flex; flex-wrap:wrap; gap:12px 16px;
  margin:0 0 18px 0;
}
.sm-clinic{ display:inline-flex; align-items:center; gap:6px; text-decoration:none; }
.sm-clinic__icon{ width:14px; height:14px; display:inline-block; }
.sm-clinic--1{ color: var(--sm-brand); }
.sm-clinic--2{ color: var(sm-brand-alt); }
.sm-clinic--more{ color: var(--sm-muted); }

/* Кнопка "Подробнее" — прижать к низу */
.sm-button--more{
  display:inline-block; 
  width:100%; 
  text-align:center;
  padding:8px 16px;
  border:1px solid var(--sm-brand);
  color: var(--sm-brand);
  background: var(--sm-on-brand);
  border-radius:999px;
  font-size:16px;
  font-weight:500; 
  line-height:1.3;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
  margin-top: auto;              /* ключ для выравнивания по нижнему краю */
}
.sm-button--more:hover,
.sm-button--more:focus{
  background: var(--sm-brand);
  border-color: var(--sm-brand);
  color: var(--sm-on-brand);
  text-decoration:none; 
  outline:none;
}
@media (min-width:922px){ .sm-button--more{ font-size:16px; } }
@media (max-width:544px){ .sm-button--more{ font-size:16px; } }


/* === Убираем Astra padding в CPT doctors archive cards === */
body.post-type-archive-doctors .ast-separate-container .sm-doctors-grid > article.sm-doctor-card.ast-article-post,
body.tax-doctor_specialty .ast-separate-container .sm-doctors-grid > article.sm-doctor-card.ast-article-post,
body.tax-doctor_clinic .ast-separate-container .sm-doctors-grid > article.sm-doctor-card.ast-article-post{
  padding: 0 !important;
}

@media (min-width:1201px){
  body.post-type-archive-doctors .ast-separate-container .sm-doctors-grid > article.sm-doctor-card.ast-article-post,
  body.tax-doctor_specialty .ast-separate-container .sm-doctors-grid > article.sm-doctor-card.ast-article-post,
  body.tax-doctor_clinic .ast-separate-container .sm-doctors-grid > article.sm-doctor-card.ast-article-post{
    padding: 0 !important;
  }
}

/* === Убираем Astra padding в CPT doctors archive cards == На всякий случай, если Astra даёт паддинг внутренним обёрткам */
body.post-type-archive-doctors .sm-doctor-card .entry-header,
body.post-type-archive-doctors .sm-doctor-card .entry-content,
body.post-type-archive-doctors .sm-doctor-card .entry-footer,
body.tax-doctor_specialty .sm-doctor-card .entry-header,
body.tax-doctor_specialty .sm-doctor-card .entry-content,
body.tax-doctor_specialty .sm-doctor-card .entry-footer,
body.tax-doctor_clinic .sm-doctor-card .entry-header,
body.tax-doctor_clinic .sm-doctor-card .entry-content,
body.tax-doctor_clinic .sm-doctor-card .entry-footer{
  padding: 0 !important;
  margin: 0 !important;
}

