/* Каталог агентств (findagency.ru).
   Отдельный файл, а не переиспользование courses.css и kursy.css: у нового
   сайта свой дизайн, он придёт позже, и заменять нужно будет один файл, а не
   выковыривать правила из чужих. Пока структура повторяет каталог курсов.
   Палитра общая с остальными каталогами: #3a5a7c, #e2e8f0, #64748b. */

.agency-page { max-width: 1200px; margin: 0 auto; padding: 28px 16px 72px; }

.agency-page__head { margin: 0 0 28px; }
.agency-page__title {
    font-size: clamp(1.9rem, 4vw, 2.5rem); font-weight: 800; line-height: 1.15;
    margin: 0; color: #1a1a1a; letter-spacing: -.01em;
}
.agency-page__lead { margin: 12px 0 0; max-width: 70ch; color: #475569; line-height: 1.65; font-size: 1.02rem; }
.agency-page__upd { margin: 10px 0 0; color: #94a3b8; font-size: .87rem; }
.agency-page__upd a { color: #64748b; }
.agency-page__h { font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 700; margin: 0 0 16px; color: #1a1a1a; }

/* ── Чипы направлений и городов ──────────────────────────────────────────
   Не выпадающие фильтры, а ссылки: каждое направление это свой адрес,
   который можно отдать поисковику и переслать человеку. */
.agency-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.agency-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 15px; border-radius: 999px;
    background: #f1f5f9; color: #334155; text-decoration: none;
    font-size: .93rem; line-height: 1; white-space: nowrap;
    transition: background .15s ease, color .15s ease;
}
.agency-chip span { color: #94a3b8; font-size: .82rem; font-variant-numeric: tabular-nums; }
.agency-chip:hover { background: #e2e8f0; color: #1a1a1a; }
.agency-chip.is-active { background: #3a5a7c; color: #fff; }
.agency-chip.is-active span { color: rgba(255,255,255,.7); }
.agency-chip--city { background: #f8fafc; border: 1px solid #e2e8f0; }
.agency-chip--reset { background: transparent; color: #3a5a7c; text-decoration: underline; }

.agency-sort {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
    padding: 0 0 18px; margin: 0 0 20px; border-bottom: 1px solid #e2e8f0; font-size: .9rem;
}
.agency-sort__label { color: #94a3b8; }
.agency-sort__item { color: #475569; text-decoration: none; border-bottom: 1px dashed #cbd5e1; }
.agency-sort__item:hover { color: #3a5a7c; }
.agency-sort__item.is-active { color: #1a1a1a; font-weight: 600; border-bottom-color: transparent; }
.agency-sort__total { margin-left: auto; color: #94a3b8; font-variant-numeric: tabular-nums; }

/* ── Карточки ────────────────────────────────────────────────────────── */
.agency-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px;
}
.agency-card {
    position: relative; display: flex; flex-direction: column; height: 100%;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.agency-card:hover { border-color: #cbd5e1; box-shadow: 0 10px 24px rgba(15,23,42,.07); transform: translateY(-2px); }
/* Ссылка-оверлей: кликается вся карточка, но текст остаётся выделяемым. */
.agency-card__overlay { position: absolute; inset: 0; z-index: 1; }
.agency-card__head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 18px 0; flex-wrap: wrap;
}
.agency-card__logo { display: flex; align-items: center; max-width: 60%; }
.agency-card__logo img { max-width: 100%; height: auto; }
.agency-card__svg svg { display: block; width: auto; height: 34px; max-width: 150px; }
.agency-card__ph {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: #eef2f7; color: #3a5a7c; font-weight: 800; font-size: 1.1rem;
}
.agency-card__body { padding: 14px 18px 0; flex: 1 1 auto; }
.agency-card__title { font-size: 1.05rem; font-weight: 700; color: #1a1a1a; margin: 0 0 6px; line-height: 1.3; }
.agency-card__text { color: #64748b; font-size: .92rem; line-height: 1.55; margin: 0 0 12px; }
.agency-card__dirs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 12px; padding: 0; }
.agency-card__dirs li {
    font-size: .78rem; color: #3a5a7c; background: #eef4fa;
    padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.agency-card__params { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.agency-card__params li { display: flex; align-items: center; gap: 7px; font-size: .88rem; color: #475569; }
.agency-card__params .ico { color: #94a3b8; width: 14px; }
.agency-card__footer {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 18px 16px; margin-top: 14px; border-top: 1px solid #f1f5f9;
    font-size: .88rem; white-space: nowrap;
}
.agency-card__rating { display: inline-flex; align-items: center; gap: 5px; color: #1a1a1a; font-weight: 600; }
.agency-card__rating .ico { color: #f5a623; }
.agency-card__rating span { color: #94a3b8; font-weight: 400; }
.agency-card__rating--empty { color: #94a3b8; font-weight: 400; }
.agency-card__more { color: #3a5a7c; font-weight: 600; }

.agency-empty { color: #64748b; }
.agency-empty a { color: #3a5a7c; }

/* ── Кнопка догрузки вместо пагинации ────────────────────────────────── */
.agency-more { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 32px 0 0; }
.agency-more__btn {
    padding: 13px 30px; border: 1px solid #3a5a7c; border-radius: 6px;
    background: #fff; color: #3a5a7c; font: inherit; font-weight: 600; font-size: .98rem;
    cursor: pointer; transition: background .15s ease, color .15s ease;
}
.agency-more__btn:hover { background: #3a5a7c; color: #fff; }
.agency-more__btn:disabled { opacity: .6; cursor: default; }
.agency-more__btn:focus-visible { outline: 2px solid #3a5a7c; outline-offset: 3px; }
.agency-more__counter { margin: 0; color: #94a3b8; font-size: .87rem; font-variant-numeric: tabular-nums; }

/* ── Таблица рейтинга ────────────────────────────────────────────────── */
.agency-page__faq, .agency-page__rating, .agency-page__text { margin-top: 48px; }
.agency-table__wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.agency-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.agency-table th, .agency-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f1f5f9; }
.agency-table thead th {
    font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
    color: #94a3b8; font-weight: 600; white-space: nowrap; background: #f8fafc;
}
.agency-table tbody tr:last-child td { border-bottom: none; }
.agency-table td:nth-child(n+3) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.agency-table a { color: #3a5a7c; }
.agency-note { margin: 12px 0 0; color: #94a3b8; font-size: .85rem; line-height: 1.55; }
.agency-note a { color: #3a5a7c; }

.agency-page__text { color: #475569; line-height: 1.75; max-width: 78ch; }
.agency-page__text h2 { font-size: 1.3rem; font-weight: 700; color: #1a1a1a; margin: 28px 0 12px; }
.agency-page__text p { margin: 0 0 16px; }
.agency-page__text a { color: #3a5a7c; }

/* ── Карточка агентства ──────────────────────────────────────────────── */
.agency-detail { max-width: 1000px; margin: 0 auto; padding: 24px 16px 72px; }
.agency-hero {
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 22px;
}
.agency-hero__logo { display: flex; align-items: center; flex: none; }
.agency-hero__svg svg { display: block; width: auto; height: 46px; max-width: 200px; }
.agency-hero__ph {
    display: inline-flex; align-items: center; justify-content: center;
    width: 60px; height: 60px; border-radius: 12px;
    background: #eef2f7; color: #3a5a7c; font-weight: 800; font-size: 1.5rem;
}
.agency-hero__head { flex: 1 1 auto; min-width: 0; }
.agency-hero__title { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px; color: #1a1a1a; }
.agency-hero__legal { color: #64748b; font-size: .9rem; margin: 0 0 6px; }
.agency-hero__cta {
    flex: none; display: inline-flex; align-items: center; padding: 11px 22px;
    background: var(--c-accent, #ff6b35); color: #fff; border-radius: 999px;
    font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.agency-hero__cta:hover { filter: brightness(.95); color: #fff; }

.agency-section { margin-top: 34px; }
.agency-section__title { font-size: 1.3rem; font-weight: 700; color: #1a1a1a; margin: 0 0 14px; }
.agency-section__lead { color: #334155; font-size: 1.02rem; line-height: 1.7; margin: 0 0 12px; }
.agency-section__body { color: #475569; line-height: 1.75; }
.agency-section__body a { color: #3a5a7c; }

.agency-facts__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.agency-facts__list li { display: inline-flex; align-items: center; gap: 8px; color: #334155; font-size: .95rem; }
.agency-facts__list .ico { color: #94a3b8; }

.agency-cases { display: grid; gap: 16px; }
.agency-case { border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px; background: #fff; }
.agency-case__title { font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; color: #1a1a1a; }
.agency-case__client { color: #94a3b8; font-size: .85rem; margin: 0 0 10px; }
.agency-case__task, .agency-case__result { margin: 0 0 8px; color: #475569; line-height: 1.6; font-size: .94rem; }
.agency-case__link { color: #3a5a7c; font-weight: 600; cursor: pointer; }

.agency-review { border-bottom: 1px solid #f1f5f9; padding: 14px 0; }
.agency-review:last-child { border-bottom: none; }
.agency-review__head { margin: 0 0 6px; color: #1a1a1a; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agency-review__rating .ico { color: #dbe2ea; font-size: .82rem; }
.agency-review__rating .ico.filled { color: #f5a623; }
.agency-review__text { margin: 0 0 6px; color: #475569; line-height: 1.6; }
.agency-review__pros, .agency-review__cons { margin: 0; color: #64748b; font-size: .9rem; }

@media (max-width: 640px) {
    .agency-page { padding: 20px 14px 56px; }
    .agency-sort__total { margin-left: 0; width: 100%; }
    .agency-table th, .agency-table td { padding: 10px 12px; }
    .agency-hero { padding: 16px; gap: 14px; }
    .agency-hero__head { flex: 1 1 100%; }
    .agency-hero__cta { width: 100%; justify-content: center; }
}
