/* Checkroi — Гид по профессиям (/guide/) */

.cr-guide {
    --cr-guide-max: 1200px;
    --cr-guide-purple: #7324FF;
    --cr-guide-purple-light: #9B5FFF;
    --cr-guide-purple-dark: #4A0DB8;
    --cr-guide-purple-bg: #F7F5FA;
    --cr-guide-text: #272B37;
}

/* --- Hero / search --- */
.cr-guide__hero {
    background: linear-gradient(135deg, #F7F5FA 0%, #EEE6FB 100%);
    padding: 56px 0 48px;
    border-bottom: 1px solid rgba(115, 36, 255, .08);
}
.cr-guide__h1 {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 14px;
    text-align: center;
    color: #272B37;
}
.cr-guide__subtitle {
    font-size: 17px;
    line-height: 1.5;
    color: #555;
    max-width: 720px;
    margin: 0 auto 32px;
    text-align: center;
}
.cr-guide__search {
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}
.cr-guide__search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #272B37;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(115, 36, 255, .12);
    overflow: hidden;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.cr-guide__search-wrap:focus-within {
    border-color: #7324FF;
    box-shadow: 0 12px 40px rgba(115, 36, 255, .28);
}
.cr-guide__search-icon {
    flex-shrink: 0;
    margin-left: 20px;
    color: #9B5FFF;
}
.cr-guide__search-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 18px;
    padding: 20px 14px;
    color: #272B37;
    font-family: inherit;
}
.cr-guide__search-input::placeholder { color: #999; }
.cr-guide__search-btn {
    border: 0;
    background: #7324FF;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 0 32px;
    align-self: stretch;
    cursor: pointer;
    transition: background .15s ease;
    font-family: inherit;
}
.cr-guide__search-btn:hover { background: #4A0DB8; }

.cr-guide__suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid rgba(115, 36, 255, .15);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(115, 36, 255, .16);
    max-height: 420px;
    overflow: auto;
    z-index: 50;
    padding: 6px;
}
.cr-guide__suggest-title {
    padding: 8px 12px 6px;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
}
.cr-guide__suggest-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #272B37;
    transition: background .12s ease;
}
.cr-guide__suggest-item:hover,
.cr-guide__suggest-item.is-active {
    background: #F7F5FA;
    text-decoration: none;
}
.cr-guide__suggest-name {
    font-size: 15px;
    font-weight: 600;
}
.cr-guide__suggest-count {
    font-size: 13px;
    color: #888;
    flex-shrink: 0;
}
.cr-guide__suggest-empty {
    padding: 18px 16px;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* --- Cluster --- */
.cr-cluster {
    margin: 32px 0;
}
.cr-cluster__loading,
.cr-cluster__empty {
    padding: 48px 24px;
    text-align: center;
    color: #888;
    background: #F7F5FA;
    border-radius: 12px;
}
.cr-cluster__header {
    position: relative;
    padding: 28px 28px 24px;
    background: linear-gradient(135deg, #7324FF 0%, #4A0DB8 100%);
    color: #fff;
    border-radius: 16px 16px 0 0;
    margin-bottom: 0;
}
.cr-cluster__title {
    margin: 0 0 6px;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 800;
    color: #fff;
}
.cr-cluster__meta {
    margin: 0;
    font-size: 15px;
    opacity: .85;
}
.cr-cluster__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s ease;
    font-family: inherit;
}
.cr-cluster__close:hover { background: rgba(255, 255, 255, .28); }

.cr-cluster__section {
    background: #fff;
    border: 1px solid rgba(115, 36, 255, .08);
    border-top: 0;
    padding: 24px 28px;
}
.cr-cluster__section:last-child {
    border-radius: 0 0 16px 16px;
    border-bottom: 1px solid rgba(115, 36, 255, .08);
}
.cr-cluster__section-title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 700;
    color: #272B37;
}
.cr-cluster__section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}
.cr-cluster__section-head .cr-cluster__section-title { margin: 0; }
.cr-cluster__section-link {
    font-size: 14px;
    font-weight: 600;
    color: #7324FF;
    text-decoration: none;
    white-space: nowrap;
}
.cr-cluster__section-link:hover { color: #4A0DB8; text-decoration: underline; }

/* Post card (overview, salary) */
.cr-cluster__post-card {
    display: flex;
    gap: 16px;
    align-items: stretch;
    text-decoration: none;
    color: inherit;
    background: #F7F5FA;
    border-radius: 12px;
    padding: 14px;
    transition: background .15s ease, transform .15s ease;
}
.cr-cluster__post-card:hover {
    background: #EEE6FB;
    text-decoration: none;
    transform: translateY(-1px);
}
.cr-cluster__post-thumb {
    flex-shrink: 0;
    width: 300px !important;
    max-width: 300px;
    height: auto !important;
    aspect-ratio: 1200 / 630;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
    display: block;
    background: #F7F5FA;
    image-rendering: auto;
}
.cr-cluster__post-card.no-thumb .cr-cluster__post-body { flex: 1; }
.cr-cluster__post-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cr-cluster__post-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    color: #272B37;
}
.cr-cluster__post-excerpt {
    font-size: 14px;
    color: #555;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cr-cluster__post-cta {
    margin-top: auto;
    font-size: 13px;
    font-weight: 700;
    color: #7324FF;
}

/* Top courses CTA */
.cr-cluster__cta {
    margin-top: 40px;
    text-align: center;
}
.cr-cluster__cta .button.skewed {
    display: inline-block;
}

/* Similar professions inside cluster */
.cr-cluster__similar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

/* --- Cluster placeholder (active ?q=) --- */
.cr-guide__cluster {
    background: #F7F5FA;
    border: 1px dashed #9B5FFF;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 32px 0;
}
.cr-guide__cluster-placeholder {
    margin: 0;
    color: #555;
    font-size: 15px;
    line-height: 1.5;
}

/* --- Main grid --- */
.cr-guide__main { padding: 48px 0 64px; }

/* Scroll target: add offset above so the user sees search bar + H1 context when a cluster loads */
.cr-guide__cluster-mount { scroll-margin-top: 120px; }
@media (max-width: 640px) {
    .cr-guide__cluster-mount { scroll-margin-top: 80px; }
}
.cr-guide__section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 24px;
}
.cr-guide__section-title {
    font-size: clamp(22px, 2.5vw, 30px);
    font-weight: 800;
    margin: 0;
    color: #272B37;
}
.cr-guide__section-count {
    font-size: 15px;
    color: #888;
    font-weight: 500;
}
.cr-guide__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

/* --- Profession card --- */
.cr-prof-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid rgba(115, 36, 255, .1);
    border-radius: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    min-height: 72px;
}
.cr-prof-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(115, 36, 255, .16);
    border-color: #7324FF;
    text-decoration: none;
}
.cr-prof-card__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #F7F5FA 0%, #E4D7FB 100%);
    color: #7324FF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}
.cr-prof-card:hover .cr-prof-card__icon {
    background: linear-gradient(135deg, #7324FF 0%, #9B5FFF 100%);
    color: #fff;
}
.cr-prof-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cr-prof-card__name {
    font-size: 15px;
    font-weight: 600;
    color: #272B37;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cr-prof-card__count {
    font-size: 13px;
    color: #888;
}

.cr-prof-card.is-overflow { display: none; }
.cr-prof-card.is-overflow.is-revealed { display: flex; }

/* --- Card loading state: spinner on the clicked card while cluster is fetched --- */
.cr-prof-card.is-loading {
    pointer-events: none;
    position: relative;
    border-color: #7324FF;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(115, 36, 255, .18);
}
.cr-prof-card.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .78);
    border-radius: inherit;
    z-index: 1;
}
.cr-prof-card.is-loading::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 26px; height: 26px;
    margin: -13px 0 0 -13px;
    border: 2.5px solid rgba(115, 36, 255, .2);
    border-top-color: #7324FF;
    border-radius: 50%;
    animation: cr-guide-spin .6s linear infinite;
    z-index: 2;
}
@keyframes cr-guide-spin { to { transform: rotate(360deg); } }

/* Чуть притемняем остальные карточки пока идёт загрузка — фокус на кликнутую */
.cr-guide__grid.is-loading .cr-prof-card:not(.is-loading) { opacity: .55; pointer-events: none; }

/* --- Load more --- */
.cr-guide__load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}
.cr-guide__load-more {
    padding: 14px 40px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.cr-guide__load-more-count {
    opacity: .7;
    font-weight: 400;
    margin-left: 6px;
}

.cr-guide__empty {
    text-align: center;
    color: #888;
    padding: 48px 0;
}

/* --- Mobile --- */
@media (max-width: 640px) {
    .cr-guide__hero { padding: 32px 0; }
    .cr-guide__search-input { font-size: 16px; padding: 16px 10px; }
    .cr-guide__search-btn { padding: 0 18px; font-size: 14px; }
    .cr-guide__search-icon { margin-left: 14px; }
    .cr-guide__grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
    .cr-prof-card { padding: 12px 14px; min-height: 64px; }
    .cr-prof-card__icon { width: 38px; height: 38px; font-size: 17px; }
    .cr-prof-card__name { font-size: 14px; }

    .cr-cluster__header { padding: 20px 18px 18px; border-radius: 12px 12px 0 0; }
    .cr-cluster__close { position: static; margin-top: 10px; display: inline-block; }
    .cr-cluster__section { padding: 18px 18px; }
    .cr-cluster__post-card { flex-direction: column; }
    .cr-cluster__post-thumb { width: 100% !important; max-width: 100%; height: auto !important; aspect-ratio: 1200 / 630; }
    .cr-cluster__similar { grid-template-columns: 1fr; }
}
