/* ==========================================================================
   RB Team
   ========================================================================== */

:root {
    --rbt-gap: 20px;
    --rbt-card-bg: var(--theme-palette-color-8, #fff);
    --rbt-card-radius: var(--theme-border-radius, 12px);
    --rbt-card-padding: var(--wp--preset--spacing--50, 24px);
    --rbt-card-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    --rbt-card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    --rbt-card-border-color: transparent;
    --rbt-card-border-active-color: var(--rbt-accent);
    --rbt-text-color: var(--theme-text-color, var(--theme-palette-color-3, #1f2937));
    --rbt-text-secondary: var(--theme-palette-color-4, #6b7280);
    --rbt-accent: var(--theme-link-initial-color, var(--theme-palette-color-1, #3b82f6));
    --rbt-pill-bg: var(--theme-palette-color-5, #f3f4f6);
    --rbt-pill-active-bg: var(--theme-palette-color-1, #3b82f6);
    --rbt-pill-active-color: #fff;
    --rbt-social-size: 20px;
    --rbt-social-color: var(--theme-palette-color-4, #6b7280);
    --rbt-social-hover-color: var(--theme-palette-color-1, #3b82f6);

    /* Text element typography — управляются через TokenRegistry */
    --rbt-name-color: var(--rbt-text-color);
    --rbt-name-font-size: 1rem;
    --rbt-name-font-weight: 600;
    --rbt-name-font-family: inherit;
    --rbt-name-letter-spacing: normal;
    --rbt-name-text-transform: none;
    --rbt-name-line-height: inherit;

    --rbt-position-color: var(--rbt-text-secondary);
    --rbt-position-font-size: 0.8125rem;
    --rbt-position-font-weight: inherit;
    --rbt-position-font-family: inherit;
    --rbt-position-letter-spacing: normal;
    --rbt-position-text-transform: none;
    --rbt-position-line-height: inherit;

    --rbt-department-color: var(--rbt-accent);
    --rbt-department-font-size: 0.75rem;
    --rbt-department-font-weight: 500;
    --rbt-department-font-family: inherit;
    --rbt-department-letter-spacing: normal;
    --rbt-department-text-transform: none;
    --rbt-department-line-height: inherit;

    --rbt-qualification-color: var(--rbt-text-secondary);
    --rbt-qualification-font-size: 0.8125rem;
    --rbt-qualification-font-weight: inherit;
    --rbt-qualification-font-family: inherit;
    --rbt-qualification-letter-spacing: normal;
    --rbt-qualification-text-transform: none;
    --rbt-qualification-line-height: inherit;

    --rbt-experience-color: var(--rbt-text-secondary);
    --rbt-experience-font-size: 0.8125rem;
    --rbt-experience-font-weight: inherit;
    --rbt-experience-font-family: inherit;
    --rbt-experience-letter-spacing: normal;
    --rbt-experience-text-transform: none;
    --rbt-experience-line-height: inherit;

    --rbt-excerpt-color: var(--rbt-text-secondary);
    --rbt-excerpt-font-size: 0.8125rem;
    --rbt-excerpt-font-weight: inherit;
    --rbt-excerpt-font-family: inherit;
    --rbt-excerpt-letter-spacing: normal;
    --rbt-excerpt-text-transform: none;
    --rbt-excerpt-line-height: inherit;
}

/* Явное тёмное (атрибут блока theme="dark") */
.rbt--theme-dark {
    --rbt-card-bg: #1e293b;
    --rbt-text-color: #f1f5f9;
    --rbt-text-secondary: #94a3b8;
    --rbt-pill-bg: #334155;
    --rbt-card-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Авто-тёмное по Blocksy (DesignCenter dark scope) */
[data-ct-dark] .rbt,
.rbt--theme-auto {
    --rbt-card-bg: var(--theme-palette-color-2, #1e293b);
    --rbt-text-color: var(--theme-palette-color-8, #f1f5f9);
    --rbt-text-secondary: var(--theme-palette-color-7, #94a3b8);
    --rbt-pill-bg: var(--theme-palette-color-3, #334155);
}

@media (prefers-color-scheme: dark) {
    .rbt--theme-auto {
        --rbt-card-bg: var(--theme-palette-color-2, #1e293b);
        --rbt-text-color: var(--theme-palette-color-8, #f1f5f9);
        --rbt-text-secondary: var(--theme-palette-color-7, #94a3b8);
        --rbt-pill-bg: var(--theme-palette-color-3, #334155);
    }
}

/* Reset */
.rbt, .rbt *, .rbt *::before, .rbt *::after {
    box-sizing: border-box; margin: 0; padding: 0; border: 0;
    font: inherit; line-height: inherit;
}
.rbt a { text-decoration: none; color: var(--rbt-accent); }
.rbt a:hover { text-decoration: underline; }
.rbt svg { display: block; }
.rbt img { display: block; max-width: 100%; height: auto; }

.rbt { color: var(--rbt-text-color); line-height: 1.5; }

/* Filter */
.rbt__filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--rbt-gap); }

.rbt__pill {
    background: var(--rbt-pill-bg); border: none; border-radius: 20px;
    color: var(--rbt-text-color); cursor: pointer; font-size: 14px;
    padding: 8px 18px; transition: background 0.2s, color 0.2s;
}
.rbt__pill:hover { background: var(--rbt-accent); color: #fff; }
.rbt__pill--active { background: var(--rbt-pill-active-bg); color: var(--rbt-pill-active-color); }

/* Grid */
.rbt__grid { display: grid; gap: var(--rbt-gap); }

@media (max-width: 767px) { .rbt__grid { grid-template-columns: 1fr !important; } }
@media (min-width: 768px) and (max-width: 1023px) {
    .rbt__grid[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
    .rbt__grid[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Card — равная высота в ряду через CSS Grid stretch + height:100% chain */
.rbt__item { height: 100%; }

.rbt-card {
    background: var(--rbt-card-bg);
    border-radius: var(--rbt-card-radius);
    box-shadow: var(--rbt-card-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.rbt-card:hover {
    box-shadow: var(--rbt-card-hover-shadow);
    transform: translateY(-2px);
}

.rbt-card__inner {
    padding: var(--rbt-card-padding);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    gap: 0;
}

/* Фото + имя + должность — прижаты к верху */
.rbt-card__top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

/* Остальные поля — прижаты к низу */
.rbt-card__bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: auto;
    padding-top: 12px;
}

/* Photo */
.rbt-card__photo { width: 96px; height: 96px; overflow: hidden; flex-shrink: 0; }
.rbt-card__photo--circle { border-radius: 50%; }
.rbt-card__photo--square { border-radius: var(--rbt-card-radius); }
.rbt-card__photo--rectangle { border-radius: var(--rbt-card-radius); width: 100%; height: auto; aspect-ratio: 3/2; }
.rbt-card__photo--portrait { border-radius: var(--rbt-card-radius); width: 100%; height: auto; aspect-ratio: 2/3; }
.rbt-card__photo img { width: 100%; height: 100%; object-fit: cover; }

/* Text — var-имена выровнены с TokenRegistry (DesignCenter) */
.rbt-card__name {
    font-size: var(--rbt-name-font-size, 1rem);
    font-weight: var(--rbt-name-font-weight, 600);
    font-family: var(--rbt-name-font-family, inherit);
    letter-spacing: var(--rbt-name-letter-spacing, normal);
    text-transform: var(--rbt-name-text-transform, none);
    line-height: var(--rbt-name-line-height, inherit);
    color: var(--rbt-name-color, var(--rbt-text-color));
}
.rbt-card__position {
    font-size: var(--rbt-position-font-size, 0.8125rem);
    font-weight: var(--rbt-position-font-weight, inherit);
    font-family: var(--rbt-position-font-family, inherit);
    letter-spacing: var(--rbt-position-letter-spacing, normal);
    text-transform: var(--rbt-position-text-transform, none);
    line-height: var(--rbt-position-line-height, inherit);
    color: var(--rbt-position-color, var(--rbt-text-secondary));
}
.rbt-card__department { font-size: 12px; color: var(--rbt-accent); font-weight: 500; }
.rbt-card__qualification, .rbt-card__experience { font-size: 13px; color: var(--rbt-text-secondary); }
.rbt-card__excerpt { font-size: 13px; color: var(--rbt-text-secondary); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rbt-card__phone a, .rbt-card__email a { font-size: 13px; }

/* Socials */
.rbt-card__socials { display: flex; gap: 10px; justify-content: center; margin-top: 4px; }
.rbt-card__social {
    width: var(--rbt-social-size); height: var(--rbt-social-size);
    color: var(--rbt-social-color); transition: color 0.2s;
}
.rbt-card__social:hover { color: var(--rbt-social-hover-color); text-decoration: none; }
.rbt-card__social svg { width: 100%; height: 100%; }

/* Slider */
.rbt__header { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.rbt__arrows { display: flex; gap: 8px; }
.rbt__arrow {
    align-items: center; background: none; border: 1px solid #d1d5db; border-radius: 50%;
    color: var(--rbt-text-color); cursor: pointer; display: flex; height: 36px;
    justify-content: center; padding: 0; transition: all 0.2s; width: 36px;
}
.rbt__arrow:hover { background: #f3f4f6; border-color: #9ca3af; }

.rbt__slider-viewport { overflow: hidden; }
.rbt__slider-track { display: flex; transition: transform 0.4s ease; }
.rbt__slide { flex-shrink: 0; }

.rbt__dots { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.rbt__dot {
    background: #d1d5db; border: none; border-radius: 50%; cursor: pointer;
    height: 8px; padding: 0; transition: background 0.2s; width: 8px;
}
.rbt__dot--active { background: var(--rbt-accent); }
.rbt__dot:hover { background: #9ca3af; }

/* Isotope */
.rbt__isotope { position: relative; }
.rbt__isotope-sizer, .rbt__isotope-item { width: calc(33.333% - var(--rbt-gap) * 2 / 3); }
.rbt[style*="--rbt-cols-2"] .rbt__isotope-sizer,
.rbt[style*="--rbt-cols-2"] .rbt__isotope-item { width: calc(50% - var(--rbt-gap) / 2); }
.rbt[style*="--rbt-cols-4"] .rbt__isotope-sizer,
.rbt[style*="--rbt-cols-4"] .rbt__isotope-item { width: calc(25% - var(--rbt-gap) * 3 / 4); }

@media (max-width: 767px) {
    .rbt__isotope-sizer, .rbt__isotope-item { width: 100% !important; }
}

/* Load more */
.rbt__load-more-wrap { margin-top: var(--rbt-gap); text-align: center; }
.rbt__load-more {
    background: none; border: 1px solid #d1d5db; border-radius: 8px;
    color: var(--rbt-text-color); cursor: pointer; font-size: 14px; padding: 10px 28px; transition: all 0.2s;
}
.rbt__load-more:hover { background: #f3f4f6; border-color: #9ca3af; }

/* Hidden */
.rbt__item[data-hidden], .rbt__slide[data-hidden], .rbt__isotope-item[data-hidden] { display: none; }

/* Detail single card */
.rbt--single .rbt-card--detail { max-width: 400px; margin: 0 auto; }
