.portfolio {
  margin-top: 56px;
  margin-bottom: 200px;
}

.portfolio-wrapper {
  display: grid;
  grid-template-columns: 408px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.portfolio-sidebar {
  position: sticky;
  top: 48px;
  align-self: start;
  display: flex;
  flex-direction: column;
}

/* Десктоп: ФИЛЬТР(1) → поиск(2) → ОТОБРАЖЕНИЕ(3) → aside с фильтрами(4) */
#portfolio-filter-header {
  order: 1;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-line-border);
  margin-bottom: 24px;
}
#portfolio-search-field {
  order: 2;
}
.portfolio-display-block {
  order: 3;
}
#portfolio-filters {
  order: 4;
}

.portfolio-filter__wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portfolio-filter-toggle {
  display: none;
  font-weight: 500;
  font-size: 14px;
  color: var(--color-main-white);
  background: transparent;
  border: none;
  cursor: pointer;
}

.portfolio-filter {
  font-weight: 500;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.portfolio-filters {
  max-width: 408px;
  width: 100%;
}

.portfolio-filters.is-hidden {
  display: none;
}

.portfolio-search-field {
  display: flex;
  align-items: stretch;
  width: 50px;
  height: 50px;
  border: 1px solid var(--color-line-border);
  background: transparent;
  overflow: hidden;
  transition:
    width 0.25s ease,
    border-color 0.2s ease;
}

.portfolio-search-field:hover {
  border-color: var(--color-main-white);
}

.portfolio-search-field.is-active,
.portfolio-search-field.is-filled,
.portfolio-search-field:focus-within {
  width: 100%;
}

.portfolio-search-icon {
  width: 50px;
  height: 50px;
  border: none;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.portfolio-search-input {
  width: 0;
  min-width: 0;
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
  font-weight: 400;
  font-size: 16px;
  line-height: 140%;
  color: var(--color-main-white);
  outline: none;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    padding 0.2s ease;
}

.portfolio-search-field.is-active .portfolio-search-input,
.portfolio-search-field.is-filled .portfolio-search-input,
.portfolio-search-field:focus-within .portfolio-search-input {
  opacity: 1;
  padding: 0 16px 0 6px;
}

.portfolio-search-input::placeholder {
  color: var(--color-text-secondary);
}

.filter-wrapper {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.filter-select {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-select__label {
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.filter-select__trigger {
  width: 100%;
  min-height: 50px;
  padding: 14px 16px 14px 16px;
  border: 1px solid var(--color-line-border);
  background: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.filter-select__trigger:hover {
  border-color: var(--color-main-white);
}

.filter-select.is-open .filter-select__trigger {
  border-color: var(--color-main-decard);
}

.filter-select.is-filled .filter-select__trigger {
  border-color: var(--color-main-white);
}

.filter-select__value {
  font-weight: 400;
  font-size: 16px;
  line-height: 140%;
  color: var(--color-text-secondary);
  text-align: left;
}

.filter-select.is-filled .filter-select__value,
.filter-select.is-open .filter-select__value {
  color: var(--color-main-white);
}

.filter-select__arrow {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.filter-select.is-open .filter-select__arrow {
  transform: rotate(180deg);
}

.filter-select__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: #191919;
  border: 1px solid var(--color-line-border);
  padding: 8px 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
  z-index: 10;
}

.filter-select.is-open .filter-select__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.filter-select__option {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-weight: 500;
  font-size: 14px;
  color: var(--color-main-white);
  cursor: pointer;
  transition: background 0.2s ease;
  text-transform: uppercase;
}

.filter-select__option:hover,
.filter-select__option.is-active {
  background: var(--color-main-decard);
}

.filter-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-block > span {
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.filter-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tag {
  border: 1px solid var(--color-line-border);
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 96px;
  height: 48px;
  padding: 0 16px;
  font-weight: 500;
  font-size: 14px;
  color: var(--color-main-white);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.filter-tag:hover {
  border-color: var(--color-main-decard);
  /*transform: translateY(-2px);*/
}

.filter-tag.is-active {
  background: var(--color-main-decard);
  border-color: var(--color-main-decard);
}

.filter-clear {
  margin-top: 24px;
  font-weight: 500;
  font-size: 16px;
  text-transform: uppercase;
  color: var(--color-main-white);
  background: transparent;
  border: none;
  cursor: pointer;
}

.portfolio-list {
  margin-top: 43px;
  padding-top: 24px;
  border-top: 1px solid var(--color-line-border);
  border-bottom: 1px solid var(--color-line-border);
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.portfolio-block {
  display: flex;
  /*grid-template-columns: minmax(420px, 1fr) minmax(280px, 408px);*/
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-line-border);
  overflow: hidden;
  perspective: 1384px;
}

.portfolio-block-link:last-child .portfolio-block {
  padding-bottom: 0;
  border: none;
}

.portfolio-block > img {
  /*width: 100%;*/
  /*aspect-ratio: 1.56 / 1;*/
  min-width: 657px;
  width: 100%;
  object-fit: cover;
  display: block;
  will-change: transform, opacity, clip-path;
  transform-origin: left center;
  backface-visibility: hidden;
}

.portfolio-block__content {
  width: 100%;
  min-width: 703px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  will-change: transform, opacity;
}

.portfolio-block__text {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.portfolio-block__title {
  font-weight: 500;
  font-size: 36px;
  line-height: 120%;
  color: var(--color-main-white);
}

.portfolio-tags__wrapper {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.portfolio-place {
  font-weight: 400;
  font-size: 20px;
  line-height: 140%;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.portfolio-tags {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.portfolio-tags span {
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--color-main-white);
  border: 1px solid var(--color-line-tag);
  padding: 4px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
}

.portfolio-block__info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portfolio-block__info span {
  font-weight: 400;
  font-size: 20px;
  line-height: 140%;
  color: var(--color-text-secondary);
}

.portfolio-loader {
  margin-top: 24px;
  display: none;
  font-weight: 500;
  font-size: 16px;
  color: var(--color-main-white);
}

.portfolio-loader.is-visible {
  display: block;
}

.portfolio-load-trigger {
  width: 100%;
  height: 1px;
}

@media screen and (max-width: 1919px) {
  .portfolio {
    margin-top: 57px;
    margin-bottom: 150px;
  }

  .portfolio-wrapper {
    display: grid;
    grid-template-columns: 306px minmax(0, 1fr);
    gap: 43px;
    align-items: start;
  }

  .portfolio-sidebar {
    position: sticky;
    top: 48px;
    align-self: start;
    display: flex;
    flex-direction: column;
  }

  .portfolio-filters {
    max-width: 306px;
    width: 100%;
  }

  .portfolio-search-input::placeholder {
    color: var(--color-text-secondary);
  }

  .filter-clear {
    font-size: 14px;
  }

  .portfolio-list {
    margin-top: 39px;
  }

  .portfolio-block {
    /*grid-template-columns: minmax(420px, 1fr) minmax(280px, 408px);*/
    gap: 18px;
    perspective: 1026px;
  }

  .portfolio-block > img {
    min-width: 487px;
    width: 100%;
    /*aspect-ratio: 1.56 / 1;*/
    object-fit: cover;
    display: block;
    will-change: transform, opacity, clip-path;
    transform-origin: left center;
    backface-visibility: hidden;
  }

  .portfolio-block__content {
    width: 100%;
    min-width: 521px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    will-change: transform, opacity;
  }

  .portfolio-block__text {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .portfolio-block__title {
    font-weight: 500;
    font-size: 24px;
    line-height: 120%;
    color: var(--color-main-white);
  }

  .portfolio-tags__wrapper {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
  }

  .portfolio-place {
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    color: var(--color-text-secondary);
    flex-shrink: 0;
  }

  .portfolio-tags {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }

  .portfolio-tags span {
    font-weight: 500;
    font-size: 12px;
    letter-spacing: normal;
    color: var(--color-main-white);
    border: 1px solid var(--color-line-tag);
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
  }

  .portfolio-block__info {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .portfolio-block__info span {
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    color: var(--color-text-secondary);
  }
}

@media screen and (max-width: 1439px) {
  .portfolio-block__content {
    min-width: auto;
  }
}

@media screen and (max-width: 1250px) {
  .portfolio-block > img {
    min-width: 447px;
    width: 100%;
    /*aspect-ratio: 1.56 / 1;*/
    object-fit: cover;
    display: block;
    will-change: transform, opacity, clip-path;
    transform-origin: left center;
    backface-visibility: hidden;
  }
}

@media screen and (max-width: 1200px) {
  .portfolio {
    margin-top: 56px;
    margin-bottom: 100px;
  }

  .portfolio-wrapper {
    display: flex;
    /*grid-template-columns: 408px minmax(0, 1fr);*/
    gap: 32px;
    align-items: start;
    flex-direction: column;
  }

  .portfolio-sidebar {
    position: relative;
    width: 100%;
    top: auto;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .portfolio-filter__wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .portfolio-filter-toggle {
    display: block;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-main-white);
    background: transparent;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
  }

  .portfolio-filter {
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text-secondary);
  }

  .portfolio-filters {
    max-width: none;
    width: 100%;
  }

  .portfolio-filters.is-hidden {
    display: none;
  }

  .portfolio-search-field {
    display: flex;
    align-items: stretch;
    width: 50px;
    height: 50px;
    border: 1px solid var(--color-line-border);
    background: transparent;
    overflow: hidden;
    transition:
      width 0.25s ease,
      border-color 0.2s ease;
  }

  .portfolio-search-field:hover {
    border-color: var(--color-main-white);
  }

  .portfolio-search-field.is-active,
  .portfolio-search-field.is-filled,
  .portfolio-search-field:focus-within {
    width: 100%;
  }

  .portfolio-search-icon {
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
  }

  .portfolio-search-input {
    width: 0;
    min-width: 0;
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    color: var(--color-main-white);
    outline: none;
    opacity: 0;
    transition:
      opacity 0.2s ease,
      padding 0.2s ease;
  }

  .portfolio-search-field.is-active .portfolio-search-input,
  .portfolio-search-field.is-filled .portfolio-search-input,
  .portfolio-search-field:focus-within .portfolio-search-input {
    opacity: 1;
    padding: 0 16px 0 6px;
  }

  .portfolio-search-input::placeholder {
    color: var(--color-text-secondary);
  }

  .filter-wrapper {
    margin-top: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px 20px;
  }

  .filter-select {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 48.6%;
  }

  .filter-select__label {
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
  }

  .filter-select__trigger {
    width: 100%;
    min-height: 50px;
    padding: 14px 16px 14px 16px;
    border: 1px solid var(--color-line-border);
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: border-color 0.2s ease;
  }

  .filter-select__trigger:hover {
    border-color: var(--color-main-white);
  }

  .filter-select.is-open .filter-select__trigger {
    border-color: var(--color-main-decard);
  }

  .filter-select.is-filled .filter-select__trigger {
    border-color: var(--color-main-white);
  }

  .filter-select__value {
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    color: var(--color-text-secondary);
    text-align: left;
  }

  .filter-select.is-filled .filter-select__value,
  .filter-select.is-open .filter-select__value {
    color: var(--color-main-white);
  }

  .filter-select__arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
  }

  .filter-select.is-open .filter-select__arrow {
    transform: rotate(180deg);
  }

  .filter-select__menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #191919;
    border: 1px solid var(--color-line-border);
    padding: 8px 10px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.2s ease,
      visibility 0.2s ease;
    z-index: 10;
  }

  .filter-select.is-open .filter-select__menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .filter-select__option {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-main-white);
    cursor: pointer;
    transition: background 0.2s ease;
    text-transform: uppercase;
  }

  .filter-select__option:hover,
  .filter-select__option.is-active {
    background: var(--color-main-decard);
  }

  .filter-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 48.6%;
  }

  .filter-block > span {
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
  }

  .filter-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .filter-tag {
    border: 1px solid var(--color-line-border);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 96px;
    height: 48px;
    padding: 0 16px;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-main-white);
    cursor: pointer;
    transition:
      background 0.2s ease,
      border-color 0.2s ease,
      color 0.2s ease,
      transform 0.2s ease;
  }

  .filter-tag:hover {
    border-color: var(--color-main-decard);
    /*transform: translateY(-2px);*/
  }

  .filter-tag.is-active {
    background: var(--color-main-decard);
    border-color: var(--color-main-decard);
  }

  .filter-clear {
    margin-top: 24px;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--color-main-white);
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .portfolio-list {
    margin-top: 0;
    padding-top: 24px;
    border-top: 1px solid var(--color-line-border);
    border-bottom: 1px solid var(--color-line-border);
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
  }

  .portfolio-block {
    display: flex;
    /*grid-template-columns: minmax(420px, 1fr) minmax(280px, 408px);*/
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-line-border);
    overflow: hidden;
    perspective: 1384px;
  }

  .portfolio-block-link:last-child .portfolio-block {
    padding-bottom: 0;
    border: none;
  }

  .portfolio-block > img {
    min-width: 354px;
    min-height: 226px;
    /*width: 100%;*/
    /*aspect-ratio: 1.56 / 1;*/
    object-fit: cover;
    display: block;
    will-change: transform, opacity, clip-path;
    transform-origin: left center;
    backface-visibility: hidden;
  }

  .portfolio-block__content {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    will-change: transform, opacity;
  }

  .portfolio-block__text {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .portfolio-block__title {
    font-weight: 500;
    font-size: 24px;
    line-height: 120%;
    color: var(--color-main-white);
  }

  .portfolio-tags__wrapper {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
  }

  .portfolio-place {
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    color: var(--color-text-secondary);
    flex-shrink: 0;
  }

  .portfolio-tags {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }

  .portfolio-tags span {
    font-weight: 500;
    font-size: 12px;
    letter-spacing: normal;
    color: var(--color-main-white);
    border: 1px solid var(--color-line-tag);
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
  }

  .portfolio-block__info {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .portfolio-block__info span {
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    color: var(--color-text-secondary);
  }
}

@media screen and (max-width: 767px) {
  .portfolio {
    margin-top: 32px;
    margin-bottom: 80px;
  }

  .portfolio-wrapper {
    display: flex;
    /*grid-template-columns: 408px minmax(0, 1fr);*/
    gap: 32px;
    align-items: start;
    flex-direction: column;
  }

  .portfolio-sidebar {
    position: relative;
    width: 100%;
    top: auto;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .portfolio-filter__wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .portfolio-filter-toggle {
    display: block;
    font-weight: 500;
    font-size: 12px;
    color: var(--color-main-white);
    background: transparent;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
  }

  .portfolio-filter {
    font-weight: 500;
    font-size: 12px;
    color: var(--color-text-secondary);
  }

  .portfolio-filters {
    max-width: none;
    width: 100%;
    padding-top: 16px;
    border-top: 1px solid var(--color-line-border);
  }

  .portfolio-filters.is-hidden {
    display: none;
  }

  .portfolio-search-field {
    display: flex;
    align-items: stretch;
    width: 50px;
    height: 50px;
    border: 1px solid var(--color-line-border);
    background: transparent;
    overflow: hidden;
    transition:
      width 0.25s ease,
      border-color 0.2s ease;
  }

  .portfolio-search-field:hover {
    border-color: var(--color-main-white);
  }

  .portfolio-search-field.is-active,
  .portfolio-search-field.is-filled,
  .portfolio-search-field:focus-within {
    width: 100%;
  }

  .portfolio-search-icon {
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
  }

  .portfolio-search-input {
    width: 0;
    min-width: 0;
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    color: var(--color-main-white);
    outline: none;
    opacity: 0;
    transition:
      opacity 0.2s ease,
      padding 0.2s ease;
  }

  .portfolio-search-field.is-active .portfolio-search-input,
  .portfolio-search-field.is-filled .portfolio-search-input,
  .portfolio-search-field:focus-within .portfolio-search-input {
    opacity: 1;
    padding: 0 16px 0 6px;
  }

  .portfolio-search-input::placeholder {
    color: var(--color-text-secondary);
  }

  .filter-wrapper {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 16px;
  }

  .filter-select {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .filter-select__label {
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
  }

  .filter-select__trigger {
    width: 100%;
    min-height: 50px;
    padding: 14px 16px 14px 16px;
    border: 1px solid var(--color-line-border);
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: border-color 0.2s ease;
  }

  .filter-select__trigger:hover {
    border-color: var(--color-main-white);
  }

  .filter-select.is-open .filter-select__trigger {
    border-color: var(--color-main-decard);
  }

  .filter-select.is-filled .filter-select__trigger {
    border-color: var(--color-main-white);
  }

  .filter-select__value {
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    color: var(--color-text-secondary);
    text-align: left;
  }

  .filter-select.is-filled .filter-select__value,
  .filter-select.is-open .filter-select__value {
    color: var(--color-main-white);
  }

  .filter-select__arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
  }

  .filter-select.is-open .filter-select__arrow {
    transform: rotate(180deg);
  }

  .filter-select__menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: #191919;
    border: 1px solid var(--color-line-border);
    padding: 8px 10px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.2s ease,
      visibility 0.2s ease;
    z-index: 10;
  }

  .filter-select.is-open .filter-select__menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .filter-select__option {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-main-white);
    cursor: pointer;
    transition: background 0.2s ease;
    text-transform: uppercase;
  }

  .filter-select__option:hover,
  .filter-select__option.is-active {
    background: var(--color-main-decard);
  }

  .filter-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
  }

  .filter-block > span {
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
  }

  .filter-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .filter-tag {
    border: 1px solid var(--color-line-border);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 96px;
    height: 48px;
    padding: 0 16px;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-main-white);
    cursor: pointer;
    transition:
      background 0.2s ease,
      border-color 0.2s ease,
      color 0.2s ease,
      transform 0.2s ease;
  }

  .filter-tag:hover {
    border-color: var(--color-main-decard);
    /*transform: translateY(-2px);*/
  }

  .filter-tag.is-active {
    background: var(--color-main-decard);
    border-color: var(--color-main-decard);
  }

  .filter-clear {
    margin-top: 24px;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    color: var(--color-main-white);
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .portfolio-list {
    margin-top: 0;
    padding-top: 24px;
    border-top: 1px solid var(--color-line-border);
    border-bottom: 1px solid var(--color-line-border);
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
  }

  .portfolio-block {
    display: flex;
    /*grid-template-columns: minmax(420px, 1fr) minmax(280px, 408px);*/
    gap: 20px;
    flex-direction: column;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-line-border);
    overflow: hidden;
    perspective: 1384px;
  }

  .portfolio-block-link:last-child .portfolio-block {
    padding-bottom: 0;
    border: none;
  }

  .portfolio-block > img {
    min-width: 335px;
    min-height: 226px;
    /*width: 100%;*/
    /*aspect-ratio: 1.56 / 1;*/
    object-fit: cover;
    display: block;
    will-change: transform, opacity, clip-path;
    transform-origin: left center;
    backface-visibility: hidden;
  }

  .portfolio-block__content {
    width: 100%;
    display: flex;
    gap: 16px;
    flex-direction: column;
    justify-content: space-between;
    will-change: transform, opacity;
  }

  .portfolio-block__text {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .portfolio-block__title {
    font-weight: 500;
    font-size: 24px;
    line-height: 120%;
    color: var(--color-main-white);
  }

  .portfolio-tags__wrapper {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
  }

  .portfolio-place {
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    color: var(--color-text-secondary);
    flex-shrink: 0;
  }

  .portfolio-tags {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }

  .portfolio-tags span {
    font-weight: 500;
    font-size: 12px;
    letter-spacing: normal;
    color: var(--color-main-white);
    border: 1px solid var(--color-line-tag);
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
  }

  .portfolio-block__info {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .portfolio-block__info span {
    font-weight: 400;
    font-size: 14px;
    line-height: 140%;
    color: var(--color-text-secondary);
  }
}

/* ═══════════════════════════════════════════════════════════════
   БЛОК ОТОБРАЖЕНИЕ + ПЕРЕКЛЮЧАТЕЛЬ ПРОЕКТЫ / ПРОДУКТЫ
   ═══════════════════════════════════════════════════════════════ */

.portfolio-display-block {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.portfolio-display-label {
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.portfolio-mode-switcher {
  display: flex;
  gap: 8px;
  width: 100%;
}

.portfolio-mode-btn {
  flex: 1;
  height: 48px;
  background: transparent;
  font-weight: 500;
  font-size: 14px;
  color: var(--color-main-white);
  cursor: pointer;
  border: 1px solid var(--color-line-border);
}

.portfolio-mode-btn.is-active {
  background: var(--color-main-decard);
  border: none;
}

/* ═══════════════════════════════════════════════════════════════
   БЛОК ТИП ПРОДУКТА (таббы)
   ═══════════════════════════════════════════════════════════════ */

.product-type-block {
  width: 100%;
  margin-top: 24px;
}

.product-type-block .filter-tags {
  gap: 8px;
}

.product-type-block .filter-tag {
}

/* ═══════════════════════════════════════════════════════════════
   СЕТКА ПРОДУКТОВ — рендеры и медиа
   ═══════════════════════════════════════════════════════════════ */

/* Обёртка одного проекта в режиме продуктов */
/* product-project-block больше не используется — единая сетка */

/* Сетка рендеров — 3 колонки (masonry через CSS columns).
   Каждая колонка укладывает свои элементы независимо, без "дыр"
   из-за разных пропорций. */
.product-renders-grid {
  column-count: 3;
  column-gap: 24px;
  width: 100%;
}

/* Элемент рендера / медиа — не должен ломаться между колонками */
.product-item {
  display: block;
  width: 100%;
  margin: 0 0 24px 0;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}

/* cols из админки — все элементы занимают одну колонку */
.product-item--half,
.product-item--third,
.product-item--full {
  display: block;
}

/* ── Обёртка медиа: position:relative для абсолютной подписи ── */
.product-item__media-wrap {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  line-height: 0; /* убирает gap под img */
}

/* Изображения — натуральная высота */
.product-item__media-wrap > img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transition: transform 0.4s ease;
}

.product-item--clickable {
  cursor: pointer;
}
.product-item--clickable:hover .product-item__media-wrap > img {
  transform: scale(1.02);
}

/* Видео — aspect-ratio 16:9 */
.product-item__media-wrap > video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  background: #000;
  object-fit: cover;
}

/* YouTube / Rutube / Vimeo — iframe 16:9 */
.product-item__iframe-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background: #000;
}
.product-item__iframe-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Подпись — абсолютом поверх .product-item__media-wrap ── */
.product-item__caption {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  justify-content: space-between;
  flex-direction: column;
  align-items: normal;
  gap: 8px;
  padding: 80px 24px 24px 24px;
  background: linear-gradient(
    0deg,
    rgba(14, 14, 14, 0.85) 0%,
    rgba(14, 14, 14, 0) 100%
  );
  pointer-events: none;
}

.product-item__media-wrap:hover .product-item__caption {
  display: flex;
}

/* Левая часть — занимает большую часть ширины (~75%),
   чтобы длинные названия не ломались по символам */
.product-item__caption-left {
  display: flex;
  justify-content: space-between;
  min-width: 0;
  flex: 1 1 75%;
  max-width: 100%;
}

/* ФИКС 5: font-weight 400 (Regular) как в макете, не 500 */
.product-item__title {
  font-weight: 500;
  font-size: 24px;
  line-height: 100%;
  color: var(--color-main-white);
  display: block;
  word-wrap: break-word; /* перенос длинных слов */
  word-break: break-word; /* альтернативный вариант */
  white-space: normal; /* разрешаем перенос (по умолчанию и так normal) */
  max-width: 100%;
}

.product-item__date {
  font-weight: 400;
  font-size: 16px;
  line-height: 140%;
  color: var(--color-main-white);
  display: block;
}

.product-item__place {
  font-weight: 400;
  font-size: 16px;
  line-height: 140%;
  color: var(--color-main-white);
  flex: 0 1 auto;
  min-width: 0;
  text-align: right;
}

/* Медиа-блок (видео/тур/презентация) использует ту же сетку product-renders-grid */

/* ═══════════════════════════════════════════════════════════════
   АДАПТИВ — переключатель и панель продуктов
   ═══════════════════════════════════════════════════════════════ */

@media screen and (max-width: 1200px) {
  /* Мобилка/планшет: ОТОБРАЖЕНИЕ(1) → ФИЛЬТР(2) → поиск(3) → aside(4) */
  .portfolio-display-block {
    order: 1;
  }
  #portfolio-filter-header {
    order: 2;
    padding-bottom: 20px;
    margin-top: 8px;
    margin-bottom: 0;
  }
  #portfolio-search-field {
    order: 3;
  }
  #portfolio-filters {
    order: 4;
  }

  .portfolio-display-block {
    margin-top: 0;
    width: 100%;
    gap: 16px;
  }

  .portfolio-mode-switcher {
    width: 100%;
    gap: 20px;
  }

  /* На планшете/мобилке aside скрывается, display-block — нет */
  .portfolio-filters.is-hidden {
    display: none;
  }

  .product-type-block .filter-tags {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .product-type-block .filter-tag {
    width: auto;
    min-width: 96px;
    justify-content: center;
    text-align: center;
  }

  /* На планшете — 1 колонка, gap 24px */
  .product-renders-grid {
    column-count: 1;
    column-gap: 0;
  }

  .product-item {
    margin-bottom: 24px;
  }

  .product-item--half,
  .product-item--third,
  .product-item--full {
    display: block;
  }

  .product-item__title {
    font-size: 14px;
  }

  .product-type-block {
    margin-bottom: 24px;
    margin-top: 0;
  }

  .product-item__caption {
    display: flex;
    position: relative;
    margin-top: 16px;
    padding: 0;
  }

  .product-item__place {
    color: var(--color-text-secondary);
  }

  .product-item__date {
    color: var(--color-text-secondary);
  }
}

@media screen and (max-width: 767px) {
  .portfolio-mode-btn {
    font-size: 12px;
    height: 44px;
  }

  .portfolio-display-label {
    font-size: 11px;
  }

  /* На мобилке — 1 колонка, gap 24px */
  .product-renders-grid {
    column-count: 1;
    column-gap: 0;
  }

  .product-item {
    margin-bottom: 24px;
  }

  .product-item--half,
  .product-item--third,
  .product-item--full {
    display: block;
  }

  .product-item__title {
    font-size: 13px;
  }

  .product-item__caption {
    padding: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════
   ГАЛЕРЕЯ ПОРТФОЛИО
   ═══════════════════════════════════════════════════════════════ */

.portfolio-gallery {
  position: fixed;
  inset: 0;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.portfolio-gallery.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.portfolio-gallery__backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-bg-black);
  cursor: pointer;
}

.portfolio-gallery__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Крестик закрыть */
.portfolio-gallery__close {
  position: absolute;
  top: 20px;
  right: 33px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
}

/* Изображение — на весь экран, contain */
.portfolio-gallery__image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.portfolio-gallery__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Кнопка «Перейти к проекту» — белая, padding 15px 33px, h50, снизу по центру */
.portfolio-gallery__project-link {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 33px;
  height: 50px;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  text-align: center;
  color: var(--color-bg-black);
  background: var(--color-main-white);
  text-decoration: none;
  white-space: nowrap;
  width: 209px;
}

/* gallery-open — запрет прокрутки */
html.gallery-open,
body.gallery-open {
  overflow: hidden;
}

@media screen and (max-width: 1919px) {
  .portfolio-gallery__close {
    top: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
  }

  .portfolio-gallery__close svg {
    width: 28px;
    height: 28px;
  }

  .product-type-block .filter-tag {
    padding: 0 14px;
  }

  .product-item__title {
    font-size: 18px;
  }

  .product-item__date {
    font-size: 12px;
  }

  .product-item__place {
    font-size: 12px;
  }
}

@media screen and (max-width: 767px) {
  .portfolio-gallery__close {
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
  }

  .portfolio-gallery__close svg {
    width: 22px;
    height: 22px;
  }

  .portfolio-mode-switcher {
    gap: 8px;
  }

  #portfolio-filter-header {
    margin-top: 16px;
  }
}

#portfolio-filter-header.header-active {
  border-bottom: none;
  padding-bottom: 0;
}

#portfolio-search-field.is-hidden {
  display: none;
}
