/**
 * The client grid on the "Клиенты" page, and the modal one of its cards opens.
 *
 * Every rule is scoped under `.siggi-clients-grid` or `.siggi-client-modal`, and
 * the file is enqueued from the shortcode's own render, so it reaches no page
 * that has no grid on it.
 *
 * The photographs arrive at whatever shape the client had them in, so each one
 * fills a fixed box and is cropped to it rather than fitted inside it — from the
 * bottom, since the subject of a client's photograph is people. That
 * is the opposite of what assets/css/partners.css does with a logo, and for the
 * opposite reason: a logo is a shape on transparency that a crop would decapitate,
 * a photograph of a ward or a kitchen is a scene whose edges are the least of it.
 * It is also what makes the rows one height, which is the whole argument for the
 * grid rule that a card's face is always the photograph.
 *
 * There is no RTL section and no entry in the theme's RTL sheet. `auto-fill` plus
 * `minmax` mirrors on its own, and the two places with a side — the close button
 * and the play badge — are positioned with logical properties.
 */

/* -------------------------------------------------------------------------
 * The grid
 * ---------------------------------------------------------------------- */

.siggi-clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.siggi-clients-grid .siggi-client {
    margin: 0;
    padding: 0;
    list-style: none;
}

.siggi-clients-grid .siggi-client__face {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    text-align: inherit;
    /* The theme's own `button` rules set a height, a colour and a radius on
       everything of that element name. A card is not one of those buttons.

       `font: inherit` with the two properties that shorthand does not carry is
       the load-bearing half: the theme dresses every `button` in Montserrat 600
       uppercase, so without this the three cards that open a modal shouted
       their names in capitals while the fourth — a `<div>`, because it has
       nothing to open — printed its own in sentence case beside them. */
    height: auto;
    color: inherit;
    border-radius: 0;
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
}

.siggi-clients-grid .siggi-client__face.is-clickable {
    cursor: pointer;
}

.siggi-clients-grid .siggi-client__thumb {
    position: relative;
    display: block;
    /* Portrait, because the photographs are: the four the client sent are
       445-580 wide by 700 tall, and the shop's own catalogue shots are 570x739.
       A landscape tile threw away two fifths of every one of them; at 4:5 the
       crop is a few pixels and the people stand whole in the card. */
    aspect-ratio: 4 / 5;
    overflow: hidden;
    margin: 0 0 12px;
    background: #f4f4f4;
    border-radius: 3px;
}

.siggi-clients-grid .siggi-client__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Whatever crop is left after the box was made portrait comes off the
       bottom, never off the top: these photographs are of people, and a centred
       crop takes the same amount from the heads as from the shoes. The first
       version of this grid cropped centred, and all four cards were beheaded. */
    object-position: center top;
    /* Only the photograph moves on hover, not the card: a grid of tiles that
       each lift is noise, and a moving card under the cursor is a click target
       that shifts. */
    transition: transform 0.4s ease;
}

.siggi-clients-grid .siggi-client__face.is-clickable:hover img,
.siggi-clients-grid .siggi-client__face.is-clickable:focus-visible img {
    transform: scale(1.04);
}

.siggi-clients-grid .siggi-client__face:focus-visible {
    outline: 2px solid #222;
    outline-offset: 3px;
}

/* The badge that says there is a video behind this photograph. Drawn in CSS
   rather than shipped as an SVG: it is a circle and a triangle, and an icon font
   would be a second reason for this page to load one. */

.siggi-clients-grid .siggi-client__play {
    position: absolute;
    inset-block-end: 12px;
    inset-inline-end: 12px;
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    transition: background 0.25s ease;
}

.siggi-clients-grid .siggi-client__play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    /* The triangle is nudged 1px past centre because an optical centre and a
       geometric one are not the same for a shape with a flat side. The rotation
       is what mirrors it under RTL; `left` is deliberate rather than logical, so
       the arrow keeps pointing the way the video plays. */
    transform: translate(-40%, -50%);
    border-style: solid;
    border-width: 7px 0 7px 12px;
    border-color: transparent transparent transparent #fff;
}

.siggi-clients-grid .siggi-client__face.is-clickable:hover .siggi-client__play,
.siggi-clients-grid .siggi-client__face.is-clickable:focus-visible .siggi-client__play {
    background: rgba(0, 0, 0, 0.8);
}

.siggi-clients-grid .siggi-client__name {
    display: block;
    font-size: 15px;
    line-height: 1.4;
    color: #222;
    /* Client names are proper nouns, often in Latin script on a page laid out
       right-to-left. Isolating one keeps a trailing bracket or dot from being
       reordered to the wrong end of it in Hebrew. */
    unicode-bidi: isolate;
}

.siggi-clients-grid .siggi-client__face.is-clickable:hover .siggi-client__name,
.siggi-clients-grid .siggi-client__face.is-clickable:focus-visible .siggi-client__name {
    color: #000;
}

@media (max-width: 480px) {
    .siggi-clients-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 20px 15px;
    }

    .siggi-clients-grid .siggi-client__play {
        width: 34px;
        height: 34px;
        inset-block-end: 8px;
        inset-inline-end: 8px;
    }

    .siggi-clients-grid .siggi-client__play::before {
        border-width: 5px 0 5px 9px;
    }

    .siggi-clients-grid .siggi-client__name {
        font-size: 13px;
    }
}

/* -------------------------------------------------------------------------
 * The modal
 * ---------------------------------------------------------------------- */

.siggi-client-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/**
 * This rule is not tidiness. `display: flex` above is a specific declaration and
 * `[hidden] { display: none }` in the user-agent sheet is not, so without it the
 * closed dialog stays laid out: a full-screen backdrop at `z-index: 10000` and
 * `opacity: 0`, swallowing every click on the page behind it. The grid looked
 * right and nothing on it could be pressed.
 */
.siggi-client-modal[hidden] {
    display: none;
}

.siggi-client-modal.is-open {
    opacity: 1;
}

/* The fade is deliberately one-way. Closing removes the cloned node in the same
   frame, because that is what stops a playing video — and fading out an empty
   dialog for 200ms would be 200ms of blank white over the page. */

.siggi-client-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.siggi-client-modal__dialog {
    position: relative;
    width: 100%;
    max-width: 860px;
    /* The dialog scrolls, the page behind it does not (see the body class): a
       long description on a phone otherwise pushes the close button off-screen
       with no way back. */
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 30px;
    background: #fff;
    border-radius: 4px;
}

.siggi-client-modal__dialog:focus {
    outline: none;
}

/**
 * The `z-index` is the whole reason this rule is not two lines shorter.
 *
 * The button is the dialog's *first* child, and `.siggi-client-modal__embed`
 * below is positioned too — so at equal stacking level the later element wins
 * and the embed paints over the button. It never showed on a wide screen, where
 * the 16:9 iframe is 800px inside an 860px dialog and stops well short of the
 * corner; on a phone the embed spans the dialog's full width and slid under the
 * ×, leaving only a 12px strip of it tappable. Measured on stage, 390px wide,
 * 2026-09-02: `elementFromPoint()` at the button's own centre returned the
 * iframe. The picture and the `<video>` never did this, because their container
 * is not positioned.
 */
.siggi-client-modal__close {
    position: absolute;
    z-index: 1;
    top: 8px;
    inset-inline-end: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: 0;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    border-radius: 0;
}

.siggi-client-modal__close:hover,
.siggi-client-modal__close:focus-visible {
    color: #000;
}

.siggi-client-modal__media {
    margin: 0 0 20px;
}

/**
 * The media is capped by **height**, not width, and that is the whole rule.
 * A client's photograph is as often portrait as landscape — the catalogue's own
 * shots are 570x739 — and a portrait one at `width: 100%` of the dialog is
 * taller than the window, which puts the name and the description below the fold
 * and makes the modal look like a lightbox that lost its caption.
 *
 * The ceiling is 70vh, not the 45vh this opened with: the picture is the reason
 * the modal is opened at all — for a client who wrote nothing it is the only
 * thing in there — and 45vh of a laptop is 400px, barely larger than the card
 * that was clicked. 70vh still leaves the name and a short paragraph visible
 * under a portrait photograph on a 900px-tall window, and the dialog scrolls
 * where it does not.
 */
.siggi-client-modal__media img,
.siggi-client-modal__video {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    margin: 0 auto;
    border-radius: 3px;
}

/* An oEmbed answer is an iframe with hard-coded width and height attributes.
   The wrapper turns those back into a ratio, which is the only way the embed
   survives a phone. */

.siggi-client-modal__embed {
    position: relative;
    /* The same 70vh ceiling as the image above, expressed the way a ratio box
       has to take it: cap the width so 16:9 of it never exceeds the height. */
    max-width: min(100%, calc(70vh * 16 / 9));
    margin: 0 auto;
    aspect-ratio: 16 / 9;
}

.siggi-client-modal__embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 3px;
}

.siggi-client-modal__name {
    margin: 0 0 12px;
    font-size: 22px;
    line-height: 1.3;
    unicode-bidi: isolate;
}

.siggi-client-modal__text {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.7;
    color: #444;
}

.siggi-client-modal__text p:last-child {
    margin-bottom: 0;
}

.siggi-client-modal__link {
    margin: 0;
}

body.siggi-client-modal-open {
    overflow: hidden;
}

@media (max-width: 575px) {
    .siggi-client-modal {
        padding: 10px;
    }

    .siggi-client-modal__dialog {
        max-height: calc(100vh - 20px);
        padding: 20px 16px;
    }

    .siggi-client-modal__name {
        font-size: 18px;
    }

    /**
     * 44x44 is the smallest target a finger hits reliably, and the desktop
     * button is 32. The offsets shrink by the same amount the box grows, so the
     * × itself stays where it was — the extra 12px are hit area, not glyph.
     */
    .siggi-client-modal__close {
        top: 4px;
        inset-inline-end: 6px;
        width: 44px;
        height: 44px;
    }
}
