/* The staff, institution and local-authority cards (Figma 12801-4853, 12385-41636, 12847-4853; their
   grid and list shapes in 5940-14). One markup: .cil-ent--grid or .cil-ent--list arranges it, and a
   phone always shows the short row the design gives it. Logical properties throughout, so a Hebrew or
   Arabic page mirrors an English or Russian one. Colours are the brand's tokens (design-system/palette.css);
   the shadows are the course card's, so the cards sit together on one page. */

.cil-ent, .cil-ent *, .cil-ent *::before, .cil-ent *::after { box-sizing: border-box; }

.cil-ent {
    /* Each kind's own colours: its cover, its outline and button line, its button's words. */
    --cil-ent-cover: var(--cil-blue-dark-1);
    --cil-ent-line: var(--cil-blue-regular-7);
    --cil-ent-ink: var(--cil-blue-dark-1);
    position: relative;
    display: flex; flex-direction: column;
    min-width: 0; min-height: 338px;
    border-radius: 12px;
    background: var(--cil-white);
    color: var(--cil-black);
    box-shadow: 0 8px 24px -4px rgba(31, 32, 32, 0.16), 0 1px 3px 0 rgba(31, 32, 32, 0.08);
    font-size: 14px; line-height: 1.2;
    transition: box-shadow .25s ease;
}
.cil-ent--staff        { --cil-ent-cover: var(--cil-blue-dark-3); --cil-ent-ink: var(--cil-blue-dark-3); }
.cil-ent--municipality { --cil-ent-cover: var(--cil-green-dark-1); --cil-ent-line: var(--cil-green-dark-1); --cil-ent-ink: var(--cil-green-dark-1); }

/* Pointed at, the card's outline draws in, its shadow deepens and its button fills (Figma: "Hover"). */
.cil-ent::after {
    content: ''; position: absolute; inset: 0; z-index: 3;
    border: 1px solid var(--cil-ent-line); border-radius: inherit;
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.cil-ent:hover { box-shadow: 0 12px 32px -4px rgba(31, 32, 32, 0.2), 0 2px 6px 0 rgba(31, 32, 32, 0.1); }
.cil-ent:hover::after { opacity: 1; }
.cil-ent:has(.cil-ent__link:focus-visible) { outline: 2px solid var(--cil-blue-dark-1); outline-offset: 2px; }

.cil-ent__cover { flex: none; height: 72px; border-radius: 12px 12px 0 0; background: var(--cil-ent-cover); }
.cil-ent--institution .cil-ent__cover { height: 80px; }

/* ---- The picture: a photo, a logo, an emblem -- or, without one, a figure or the name's word ---- */
.cil-ent__avatar {
    position: absolute; z-index: 1; top: 24px; inset-inline-start: 16px;
    display: grid; grid-template: 100% / 100%; place-items: center;
    width: 96px; height: 96px; overflow: hidden;
    border-radius: 50%;
    background: var(--cil-blue-light-5);
}
/* Pinned to the frame, so a listed WebP's <picture> around it (display: contents) changes nothing. */
.cil-ent__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cil-ent__logo { max-width: 68px; max-height: 48px; object-fit: contain; }
.cil-ent__wordmark { padding-inline: 6px; color: var(--cil-ent-ink); font-size: 18px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.cil-ent--institution .cil-ent__avatar {
    top: 36px; inset-inline-start: 20px; width: 88px; height: 88px; border-radius: 12px;
    border: 1px solid var(--cil-black-light-2); background: var(--cil-white);
    box-shadow: 0 2px 8px 0 rgba(31, 32, 32, 0.12);
}
.cil-ent--municipality .cil-ent__avatar {
    top: 32px; inset-inline-start: 20px; width: 80px; height: 80px; border-radius: 16px;
    background: var(--cil-white);
    filter: drop-shadow(0 8px 12px rgba(31, 32, 32, 0.16)) drop-shadow(0 1px 1.5px rgba(31, 32, 32, 0.08));
}
.cil-ent--municipality .cil-ent__logo { max-width: 64px; }
.cil-ent--institution .cil-ent__avatar.is-empty { background: var(--cil-blue-light-1); }
.cil-ent--municipality .cil-ent__avatar.is-empty { background: var(--cil-green-light-1); }

/* ---- The words ---- */
.cil-ent__body { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 56px 20px 20px; }
.cil-ent--institution .cil-ent__body { padding-top: 58px; }
.cil-ent--municipality .cil-ent__body { padding-top: 52px; }
.cil-ent__details { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-width: 0; }
.cil-ent__heading { display: flex; flex-direction: column; gap: 4px; width: 100%; min-height: 64px; }

/* A long name wraps to a second line, then ends in "…" (Figma: "Long name"). */
.cil-ent__name {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
    margin: 0; color: var(--cil-black); font-size: 18px; font-weight: 700; line-height: 1.2;
    transition: color .2s ease;
}
.cil-ent:hover .cil-ent__name { color: var(--cil-ent-ink); }
/* The card's one link reaches across all of it; pointed at, the theme's green does not reach it. */
.cil-ent .cil-ent__link, .cil-ent .cil-ent__link:is(:hover, :focus, :visited) { color: inherit; text-decoration: none; }
.cil-ent .cil-ent__link:focus-visible { outline: none; }
.cil-ent__link::after { content: ''; position: absolute; inset: 0; z-index: 2; border-radius: 12px; }
.cil-ent__line { margin: 0; overflow: hidden; color: var(--cil-black-regular-7); font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }

.cil-ent__stats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; }
.cil-ent__stat { display: inline-flex; align-items: center; gap: 6px; color: var(--cil-black); font-size: 14px; font-weight: 600; white-space: nowrap; }
.cil-ent__stat img { flex: none; display: block; width: 16px; height: 16px; }
.cil-ent--municipality .cil-ent__stat { color: var(--cil-black-regular-7); font-weight: 400; }

.cil-ent__chips { display: flex; gap: 6px; max-width: 100%; margin: 0; padding: 0; list-style: none; }
.cil-ent__chip {
    min-width: 0; padding: 3px 10px; overflow: hidden;
    border: 1px solid var(--cil-black-light-3); border-radius: 12px; background: var(--cil-white);
    color: var(--cil-black-regular-7); font-size: 14px; white-space: nowrap; text-overflow: ellipsis;
}
.cil-ent__chip--more { flex: none; }

.cil-ent__cta {
    display: flex; align-items: center; justify-content: center; flex: none;
    height: 40px; padding-inline: 20px;
    border: 1px solid var(--cil-ent-line); border-radius: 20px;
    background: var(--cil-white); color: var(--cil-ent-ink);
    font-size: 14px; font-weight: 700; white-space: nowrap;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.cil-ent--municipality .cil-ent__cta { font-weight: 600; }
.cil-ent:hover .cil-ent__cta { border-color: var(--cil-ent-ink); background: var(--cil-ent-ink); color: var(--cil-white); }

/* The phone's arrow, at the row's far end; it points along the line of reading. */
.cil-ent__go { display: none; flex: none; }
.cil-ent__go img { display: block; width: 16px; height: 16px; }
.cil-ent__goLtr, .lang-to-css-ltr .cil-ent__goRtl { display: none !important; }
.lang-to-css-ltr .cil-ent__goLtr { display: block !important; }

/* ---- The list: one row, the picture at the start, the button at the end ---- */
.cil-ent--list { flex-direction: row; align-items: center; gap: 16px; min-height: 129px; padding: 16px; }
.cil-ent--list .cil-ent__cover { display: none; }
.cil-ent--list .cil-ent__avatar { position: relative; top: auto; inset-inline-start: auto; flex: none; }
.cil-ent--list.cil-ent--staff .cil-ent__avatar { width: 88px; height: 88px; }
.cil-ent--list.cil-ent--institution .cil-ent__avatar { width: 96px; height: 96px; border: 0; box-shadow: none; background: var(--cil-white-light-2); }
.cil-ent--list.cil-ent--institution .cil-ent__logo { max-width: 72px; max-height: 56px; }
.cil-ent--list.cil-ent--municipality { gap: 20px; padding: 20px; padding-inline-start: 28px; }
.cil-ent--list.cil-ent--municipality .cil-ent__cover { display: block; position: absolute; inset-block: 0; inset-inline-start: 0; width: 8px; height: auto; border-radius: 0; }
.cil-ent--list.cil-ent--municipality .cil-ent__avatar { width: 72px; height: 72px; border-radius: 12px; background: var(--cil-green-light-1); filter: none; }
.cil-ent--list.cil-ent--municipality .cil-ent__logo { max-width: 48px; max-height: 48px; }
.cil-ent--list .cil-ent__body { flex-direction: row; align-items: center; gap: 16px; padding: 0; }
.cil-ent--list.cil-ent--municipality .cil-ent__body { gap: 20px; }
.cil-ent--list .cil-ent__details { gap: 6px; }
.cil-ent--list.cil-ent--municipality .cil-ent__details { gap: 8px; }
.cil-ent--list .cil-ent__heading { min-height: 0; }
.cil-ent--list .cil-ent__cta { order: 2; }

/* ---- A phone: the short row, its arrow in place of the button ----
   A list always; a grid where the page asks for the row (the search results, cil-ent--phoneRow). The
   directories' grids keep the whole card on a phone, a little shorter (Figma 13646-7207, 13646-15527). */
@media (max-width: 640px) {
    :is(.cil-ent--phoneRow, .cil-ent--list) { flex-direction: row; align-items: center; gap: 12px; min-height: 96px; padding: 12px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__cover { display: none; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__avatar { position: relative; top: auto; inset-inline-start: auto; flex: none; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--staff .cil-ent__avatar { width: 64px; height: 64px; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--staff .cil-ent__placeholder { width: 38px; height: 38px; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--institution .cil-ent__avatar { width: 72px; height: 72px; border: 0; box-shadow: none; background: var(--cil-white-light-2); }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--institution .cil-ent__logo { max-width: 56px; max-height: 40px; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--municipality { padding: 16px; padding-inline-start: 24px; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--municipality .cil-ent__cover { display: block; position: absolute; inset-block: 0; inset-inline-start: 0; width: 8px; height: auto; border-radius: 0; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--municipality .cil-ent__avatar { width: 56px; height: 56px; border-radius: 12px; background: var(--cil-green-light-1); filter: none; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--municipality .cil-ent__logo { max-width: 40px; max-height: 40px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__wordmark { font-size: 16px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__body { flex-direction: row; align-items: center; padding: 0; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__details { gap: 4px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__heading { min-height: 0; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__name { font-size: 16px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__line { font-size: 12px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__stats { gap: 4px 12px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__stat { font-size: 12px; font-weight: 400; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__stat img { width: 14px; height: 14px; }
    :is(.cil-ent--phoneRow, .cil-ent--list) :is(.cil-ent__chips, .cil-ent__cta) { display: none; }
    :is(.cil-ent--phoneRow, .cil-ent--list) .cil-ent__go { display: block; }
    :is(.cil-ent--phoneRow, .cil-ent--list).cil-ent--municipality .cil-ent__go img { width: 20px; height: 20px; }

    /* The whole card on a phone: a lower cover and a smaller picture. */
    .cil-ent--grid:not(.cil-ent--phoneRow) { min-height: 326px; }
    .cil-ent--grid.cil-ent--staff:not(.cil-ent--phoneRow) .cil-ent__cover { height: 64px; }
    .cil-ent--grid.cil-ent--staff:not(.cil-ent--phoneRow) .cil-ent__avatar { top: 20px; width: 88px; height: 88px; }
    .cil-ent--grid.cil-ent--staff:not(.cil-ent--phoneRow) .cil-ent__body { padding-top: 52px; }
    .cil-ent--grid.cil-ent--institution:not(.cil-ent--phoneRow) .cil-ent__cover { height: 72px; }
    .cil-ent--grid.cil-ent--institution:not(.cil-ent--phoneRow) .cil-ent__avatar { top: 32px; width: 80px; height: 80px; }
    .cil-ent--grid.cil-ent--institution:not(.cil-ent--phoneRow) .cil-ent__logo { max-width: 52px; max-height: 52px; }
    .cil-ent--grid.cil-ent--institution:not(.cil-ent--phoneRow) .cil-ent__body { padding-top: 54px; }
}

/* ---- Waiting for its pictures (catalogue-pages/assets/skeleton.css): grey blocks and bars ---- */
.cil-ctl-js .cil-ctl-skel .cil-ent { box-shadow: none; outline: 1px solid var(--cil-black-light-3); outline-offset: -1px; }
.cil-ctl-js .cil-ctl-skel .cil-ent__cover,
.cil-ctl-js .cil-ctl-skel .cil-ent__avatar { border-color: transparent; background: var(--cil-ctl-sk); box-shadow: none; filter: none; }
.cil-ctl-js .cil-ctl-skel .cil-ent__avatar > *,
.cil-ctl-js .cil-ctl-skel :is(.cil-ent__chips, .cil-ent__stat img, .cil-ent__go) { visibility: hidden; }
.cil-ctl-js .cil-ctl-skel :is(.cil-ent__link, .cil-ent__line, .cil-ent__stat span) {
    color: transparent !important; background: var(--cil-ctl-sk); border-radius: 999px;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.cil-ctl-js .cil-ctl-skel .cil-ent__cta { border-color: transparent; background: var(--cil-ctl-sk); color: transparent; }

@media (prefers-reduced-motion: reduce) {
    .cil-ent, .cil-ent::after, .cil-ent__name, .cil-ent__cta { transition: none; }
}
