.project-library {
    background: #f5f6f8;
}

.project-library__container {
    width: min(100%, 1880px);
    padding-inline: clamp(18px, 3vw, 56px);
}

.project-filter-panel {
    position: sticky;
    top: 92px;
    z-index: 30;
    margin-bottom: 34px;
    padding: 18px;
    border: 1px solid rgba(18, 25, 48, .09);
    border-radius: 16px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 14px 40px rgba(10, 15, 30, .09);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.project-filter-panel__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.project-filter-panel__top > div {
    display: flex;
    align-items: baseline;
    gap: 11px;
}

.project-filter-panel__top strong {
    color: var(--header);
    font-size: 17px;
}

.project-filter-panel__top span {
    color: #697083;
    font-size: 13px;
    font-weight: 650;
}

.project-clear-filters {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: var(--theme);
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
}

.project-clear-filters:disabled {
    opacity: .38;
    cursor: default;
}

.project-filter-groups {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.project-filter-group {
    position: relative;
    min-width: 0;
}

.project-filter-group summary {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
        "label count arrow"
        "selection count arrow";
    align-items: center;
    min-height: 60px;
    padding: 9px 38px 9px 13px;
    border: 1px solid rgba(18, 25, 48, .13);
    border-radius: 10px;
    background: #fff;
    color: var(--header);
    cursor: pointer;
    list-style: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.project-filter-group summary::-webkit-details-marker {
    display: none;
}

.project-filter-group summary:hover,
.project-filter-group summary:focus-visible,
.project-filter-group[open] summary,
.project-filter-group.has-selection summary {
    border-color: var(--theme);
}

.project-filter-group summary:focus-visible {
    outline: 3px solid rgba(139, 22, 77, .16);
    outline-offset: 2px;
}

.project-filter-group__label {
    grid-area: label;
    min-width: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .045em;
    line-height: 1.2;
    text-transform: uppercase;
}

.project-filter-group__selection {
    grid-area: selection;
    min-width: 0;
    margin-top: 4px;
    overflow: hidden;
    color: #747b8c;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-filter-group__count {
    grid-area: count;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    margin-left: 6px;
    padding-inline: 5px;
    border-radius: 999px;
    background: var(--theme);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.project-filter-group__count[hidden] {
    display: none;
}

.project-filter-group summary > i {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform .2s ease;
}

.project-filter-group[open] summary > i {
    transform: translateY(-50%) rotate(180deg);
}

.project-filter-group__menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 50;
    width: max(100%, 245px);
    max-height: 330px;
    padding: 8px;
    overflow-y: auto;
    border: 1px solid rgba(18, 25, 48, .1);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(8, 13, 28, .16);
}

.project-filter-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    margin: 0;
    padding: 9px 8px;
    border-radius: 8px;
    color: var(--header);
    cursor: pointer;
    transition: background .18s ease;
}

.project-filter-option:hover {
    background: #f4f4f7;
}

.project-filter-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.project-filter-option__check {
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border: 1.5px solid #b8bdc8;
    border-radius: 5px;
    background: #fff;
    color: #fff;
    font-size: 9px;
}

.project-filter-option input:checked + .project-filter-option__check {
    border-color: var(--theme);
    background: var(--theme);
}

.project-filter-option input:focus-visible + .project-filter-option__check {
    outline: 3px solid rgba(139, 22, 77, .18);
    outline-offset: 2px;
}

.project-filter-option__name {
    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
}

.project-filter-option small {
    color: #8a90a0;
    font-size: 11px;
    font-weight: 700;
}

.project-active-filters {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(18, 25, 48, .08);
}

.project-active-filters[hidden] {
    display: none;
}

.project-active-filters > span {
    padding-top: 7px;
    color: #747b8c;
    font-size: 12px;
    font-weight: 700;
}

#projectActiveFilterChips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.project-active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid rgba(139, 22, 77, .22);
    border-radius: 999px;
    background: rgba(139, 22, 77, .07);
    color: var(--theme);
    font: inherit;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}

.project-active-filter-chip:hover {
    background: var(--theme);
    color: #fff;
}

.project-gallery {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(14px, 1.6vw, 26px);
}

.project-gallery-card {
    min-width: 0;
    overflow: hidden;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(9, 14, 27, .08);
    transition: transform .28s ease, box-shadow .3s ease;
}

.project-gallery-card[hidden] {
    display: none !important;
}

.project-gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 52px rgba(9, 14, 27, .15);
}

.project-gallery-card__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #151828;
}

.project-gallery-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .55s cubic-bezier(.2, .7, .2, 1);
}

.project-gallery-card:hover .project-gallery-card__media img {
    transform: scale(1.055);
}

.project-gallery-card__shade {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(7, 9, 18, .68));
    transition: opacity .3s ease;
}

.project-gallery-card:hover .project-gallery-card__shade {
    opacity: 1;
}

.project-gallery-card__zoom {
    position: absolute;
    right: 18px;
    bottom: 18px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
    color: var(--theme);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .3s ease, transform .3s ease;
}

.project-gallery-card:hover .project-gallery-card__zoom,
.project-gallery-card__media:focus-visible .project-gallery-card__zoom {
    opacity: 1;
    transform: translateY(0);
}

.project-gallery-card__caption {
    padding: 19px 20px 21px;
}

.project-gallery-card__caption h2 {
    margin: 0;
    color: var(--header);
    font-size: clamp(17px, 1.2vw, 21px);
    line-height: 1.3;
}

.project-gallery-card__caption p {
    margin: 8px 0 0;
    color: #6e7483;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.45;
}

.project-gallery-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 13px;
}

.project-gallery-card__tags span {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(139, 22, 77, .07);
    color: var(--theme);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .025em;
    line-height: 1.2;
    text-transform: uppercase;
}

.project-gallery-empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 70px 20px;
    color: var(--header);
    text-align: center;
}

.project-gallery-empty[hidden] {
    display: none;
}

.project-gallery-empty i {
    margin-bottom: 8px;
    color: var(--theme);
    font-size: 42px;
}

.project-gallery-empty strong {
    font-size: 20px;
}

.project-gallery-empty span {
    color: #747b8c;
    font-size: 13px;
}

@media (max-width: 1399px) {
    .project-filter-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .project-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 991px) {
    .project-filter-panel { position: relative; top: auto; }
    .project-filter-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .project-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 575px) {
    .project-library__container { padding-inline: 14px; }
    .project-filter-panel { margin-bottom: 22px; padding: 13px; border-radius: 12px; }
    .project-filter-panel__top { align-items: flex-start; }
    .project-filter-panel__top > div { display: grid; gap: 2px; }
    .project-filter-groups { grid-template-columns: 1fr; }
    .project-filter-group__menu { position: static; width: 100%; margin-top: 7px; box-shadow: none; }
    .project-active-filters { display: block; }
    .project-active-filters > span { display: block; padding: 0 0 8px; }
    .project-gallery { grid-template-columns: 1fr; gap: 16px; }
    .project-gallery-card__caption { padding: 16px 17px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .project-gallery-card,
    .project-gallery-card *,
    .project-filter-group summary,
    .project-filter-group summary > i {
        transition: none !important;
    }
}
