.document-card__wrapper--link {
    color: var(--primary-black);
    border-radius: var(--border-radius-s);
    cursor: pointer;
}

.document-card__wrapper--link .document-card__pict,
.document-card__wrapper--link .document-card__name,
.document-card__wrapper--link .document-card__open {
    transition: color 180ms ease, transform 180ms ease;
}

.document-card__wrapper--link:focus-visible {
    outline: 3px solid var(--orange-700);
    outline-offset: 5px;
}

.document-card__open {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    width: fit-content;
    margin-top: 4px;
    padding-bottom: 2px;
    font-weight: 600;
    font-size: 2rem;
    line-height: 1.2;
    color: var(--primary-black);
    border-bottom: 1px solid currentColor;
}

.document-viewer {
    width: min(1040px, calc(100vw - 80px));
    max-width: none;
    max-height: calc(100dvh - 60px);
    margin: auto;
    padding: 0;
    color: var(--primary-black);
    background-color: var(--gray-60);
    border: 0;
    border-radius: var(--border-radius-l);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.document-viewer::backdrop {
    background-color: rgba(23, 20, 24, 0.76);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.document-viewer__inner {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    max-height: calc(100dvh - 60px);
}

.document-viewer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 20px 18px 26px;
    color: var(--primary-white);
    background-color: var(--header-bg);
}

.document-viewer__title {
    min-width: 0;
    margin: 0;
    font-family: var(--second-font);
    font-size: 3.2rem;
    line-height: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.document-viewer__actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 12px;
}

.document-viewer__open {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--primary-white);
    border: 1px solid var(--gray-810);
    border-radius: var(--border-radius-xxl);
}

.document-viewer__open:hover,
.document-viewer__open:focus-visible {
    color: var(--primary-black);
    background-color: var(--primary-yellow-100);
    border-color: var(--primary-yellow-100);
}

.document-viewer__close {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    background-color: var(--primary-yellow-100);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.document-viewer__close::before,
.document-viewer__close::after {
    content: "";
    position: absolute;
    top: 21px;
    left: 12px;
    width: 20px;
    height: 2px;
    background-color: var(--primary-black);
}

.document-viewer__close::before {
    transform: rotate(45deg);
}

.document-viewer__close::after {
    transform: rotate(-45deg);
}

.document-viewer__close:hover,
.document-viewer__close:focus-visible {
    background-color: var(--primary-yellow-200);
    outline: 2px solid var(--primary-white);
    outline-offset: 2px;
}

.document-viewer__body {
    display: flex;
    min-height: 0;
    padding: 24px;
    background-color: var(--gray-75);
    overflow: auto;
    overscroll-behavior: contain;
}

.document-viewer__img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: calc(100dvh - 170px);
    margin: auto;
    object-fit: contain;
    background-color: var(--primary-white);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

body.document-viewer-is-open {
    overflow: hidden;
}

@media (hover: hover) {
    .document-card__wrapper--link:hover .document-card__pict {
        transform: translateY(-5px);
    }

    .document-card__wrapper--link:hover .document-card__name,
    .document-card__wrapper--link:hover .document-card__open {
        color: var(--orange-700);
    }
}

@media only screen and (max-width: 1199px) {
    .document-card__open {
        font-size: 1.8rem;
    }
}

@media only screen and (max-width: 767px) {
    .document-card__wrapper--link:focus-visible {
        outline-width: 2px;
        outline-offset: 3px;
    }

    .document-card__open {
        font-size: 1.5rem;
    }

    .document-viewer {
        width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: var(--border-radius-m);
    }

    .document-viewer__inner {
        max-height: calc(100dvh - 24px);
    }

    .document-viewer__head {
        gap: 12px;
        padding: 12px 12px 12px 16px;
    }

    .document-viewer__title {
        font-size: 2.2rem;
    }

    .document-viewer__actions {
        gap: 8px;
    }

    .document-viewer__open {
        padding: 9px 12px;
        font-size: 1.3rem;
    }

    .document-viewer__close {
        width: 38px;
        height: 38px;
    }

    .document-viewer__close::before,
    .document-viewer__close::after {
        top: 18px;
        left: 10px;
        width: 18px;
    }

    .document-viewer__body {
        padding: 12px;
    }

    .document-viewer__img {
        max-height: calc(100dvh - 112px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .document-card__wrapper--link .document-card__pict,
    .document-card__wrapper--link .document-card__name,
    .document-card__wrapper--link .document-card__open {
        transition: none;
    }
}
